RonnyPfannschmidt / prance

Resolving Swagger/OpenAPI 2.0 and 3.0 Parser
Other
226 stars 44 forks source link

Validating schema fails on recursion openapi 3.0.3 #124

Open leonpros opened 2 years ago

leonpros commented 2 years ago

Expected Behavior

Validation of yaml/json file should be ok.

Minimal Example Spec

Example of yaml that fails to validate:

File: type: object properties: absoluteFile: $ref: '#/components/schemas/File' absolutePath: type: string canonicalFile: $ref: '#/components/schemas/File' file: type: boolean

Actual Behavior

prance validate .\Tests_API\openapi.yaml

ERROR in ".\Tests_API\openapi.yaml" [ResolutionError]: Recursion reached limit of 1 trying to resolve "file:///C:/Tests_API/openapi.json#/components/schemas/File"! file:///C:/Tests_API/openapi.json#/components/schemas/File file:///C:/Tests_API/openapi.json#/components/schemas/File

Steps to Reproduce

Environment

s3rgeym commented 2 years ago

how to fix this shit?

leonpros commented 1 year ago

how to fix this shit?

I would suggest using the --no-resolve flag if you are trying to use command line:
prance validate --backend=openapi-spec-validator --no-resolve openapi

In robot framework, I tried using recursion_limit=100, but it still fails.
Tried adding the specific endpoints to ignore ignored_endpoints=..., but i guess i don't know the syntax either.

chineseluo commented 3 months ago

+1

Archelyst commented 1 week ago

If you are using the Pytohn API you can provide a recursion_limit_handler which will be called when recursion is detected.