-
-
Notifications
You must be signed in to change notification settings - Fork 773
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
openapi.json cannot be delivered after calling an endpoint with a $ref request body #2029
Comments
I have a similar error - spec validation failing with |
I have the same problem with the migration to connection 3 |
Same here. Looks like this was introduced in the latest release. As a workaround, downgrading from |
Can confirm I've hit this with Connexion 3.2.0 as well. Rolling back to Connexion 3.1.0 fixes it for now. |
Rolling back to 3.1.0 helped us too with an inconsistent validation failure due to a supposed recursion issue when using
Simplified version of the spec that was used: openapi: 3.0.0
info:
title: sample
version: 0.0.1
paths:
/sample:
post:
operationId: sample
requestBody:
$ref: '#/components/requestBodies/Sample'
responses:
200:
$ref: '#/components/responses/Sample'
components:
schemas:
Sample:
type: object
properties:
example:
type: string
requestBodies:
Sample:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Sample'
responses:
Sample:
description: Response of sample endpoint
content:
application/json:
schema:
type: object |
pin connexion to ~=3.1.0 because of spec-first/connexion#2029 RHINENG-14559
pin connexion to ~=3.1.0 because of spec-first/connexion#2029 RHINENG-14559
Problem description
When creating a Connexion app with an OpenAPI spec which uses
$ref
to reference the request body schema, requesting/openapi.json
leads to an error after the endpoint which uses$ref
in the specification has been called.Minimal example
connexion["swagger-ui"]
(anduvicorn
for serving), and paste the files below.uvicorn run:app
/greeting
endpointContents of openapi.yaml:
Contents of run.py:
Error message
More details
The issue seems to be that #2002 returns the processed OpenAPI spec, which contains a
components
key inside theschema
, so that the OpenAPI schema validator complains (correctly) about an invalid spec and/openapi.json
refuses to deliver the spec. In fact, some testing shows that reverting bb48fb3 fixes the issue.I'm not really sure but this might be related to the discussion in #1829.
Sample test
Something like the following might work as an integration test with the
openapi.yaml
from above (I used this for finding bb48fb3; maybe this helps):The text was updated successfully, but these errors were encountered: