openapi-changes
openapi-changes copied to clipboard
Bad handling of Yaml in diff around string
given the snippet
schemas:
Pet:
type: object
properties:
id:
readOnly: true
type: string
name:
type: string
enum:
- Bob
and this snippet
schemas:
Pet:
type: object
properties:
id:
readOnly: true
type: string
name:
type: string
enum:
- "Bob"
it is shown as differnt (add / remove) where this in yml stuff
Will investigate
The following test passes:
func TestCompareSchemas_CheckEnums(t *testing.T) {
left := `openapi: 3.1.0
components:
schemas:
Pet:
type: object
properties:
id:
readOnly: true
type: string
name:
type: string
enum:
- Bob`
right := `openapi: 3.1.0
components:
schemas:
Pet:
type: object
properties:
id:
readOnly: true
type: string
name:
type: string
enum:
- "Bob"`
leftDoc, rightDoc := test_BuildDoc(left, right)
// extract left reference schema and non reference schema.
lSchemaProxy := leftDoc.Components.Value.FindSchema("Pet").Value
rSchemaProxy := rightDoc.Components.Value.FindSchema("Pet").Value
changes := CompareSchemas(lSchemaProxy, rSchemaProxy)
assert.Nil(t, changes)
assert.Equal(t, 0, changes.TotalChanges())
}
can you provide a working sample or is this fixed?
fixed thanks to libOpenAPI changes ... woudl requires a release of openapic hanges with recent libopenapi