Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] ordering in required statement should not matter #108

Open
LasneF opened this issue Feb 26, 2024 · 1 comment
Open

[bug] ordering in required statement should not matter #108

LasneF opened this issue Feb 26, 2024 · 1 comment
Labels
bug Something isn't working cannot reproduce

Comments

@LasneF
Copy link
Contributor

LasneF commented Feb 26, 2024

required ;

  • a
  • b

and required :

  • b
  • a

should not be considered as a difference even not a warning or noticed

@daveshanley daveshanley added bug Something isn't working needs investigation labels Mar 6, 2024
@daveshanley
Copy link
Member

The following test passes:

func TestCompareSchemas_CheckRequiredOrdering(t *testing.T) {
	left := `openapi: 3.1.0
components:
  schemas:
    Ordering:
      required:
        - one
        - three
      properties:
        three: 
          type: string
        one: 
           type: string`

	right := `openapi: 3.1.0
components:
  schemas:
    Ordering:
      required:
        - three
        - one
      properties:
        three: 
          type: string
        one: 
           type: string`

	leftDoc, rightDoc := test_BuildDoc(left, right)

	// extract left reference schema and non reference schema.
	lSchemaProxy := leftDoc.Components.Value.FindSchema("Ordering").Value
	rSchemaProxy := rightDoc.Components.Value.FindSchema("Ordering").Value

	changes := CompareSchemas(lSchemaProxy, rSchemaProxy)
	assert.Nil(t, changes)
	assert.Equal(t, 0, changes.TotalChanges())
}```

Can you provide a snippet where I can re-create this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cannot reproduce
Projects
None yet
Development

No branches or pull requests

2 participants