`Index.GetAllSchemas()` regression in values returned
TristanSpeakEasy opened this issue · 6 comments
Between versions v0.15.14
and v0.16.2
there seems to have been a regression in what GetAllSchemas()
from the index returns.
Basically we are seeing "schema" like objects under examples
being returned which shouldn't be as they aren't schemas but just examples
Here is a spec that shows the issue https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Lending.yaml
For example line 69399
is a object that is being returned in the list from GetAllSchemas()
Looks to have been introduced in v0.16.1
Specifically this commit 1e22e02
An example spec that returns more than the 1 schema actually included in it from GetAllSchemas()
openapi: 3.1.0
paths:
'/test':
get:
responses:
'200':
content:
application/json:
schema:
type: object
examples:
test example:
value:
type: Object
description: test
properties:
lineItems:
type: Array
description: test
properties:
description:
required: false
taxRateRef:
type: Object
description: test
properties:
effectiveTaxRate:
type: Number
description: test
required: false
required: true
paymentAllocations:
type: Array
description: test
properties:
payment:
type: Object
description: test
properties:
accountRef:
type: Object
Looks like this change introduced the issue
1e22e02#diff-d9bde18e87a806403ee7c4564cad7bc2fcbc9835d3730f3f550c2b414ce09f89R447
PR to fix this here: #281
I don't fully understand the root cause but the issue seems to have been introduced by not continue any further logic in this file when examples was detected.
This change ensures that the original behaviour is retained while also handling the case the change in the commit that regressed this is also addressed
Strange that this caused a regression, but thank you for fixing it!