-
Notifications
You must be signed in to change notification settings - Fork 34
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
Error starting glued server due to suspect schema error #70
Comments
Hi, I had a look and the error is from fastify, not fastify-openapi-glue. Putting in a {
"method": "POST",
"url": "/MyPath",
"schema": {
"summary": "My Test Path",
"response": {
"200": {
"allOf": [
{
"allOf": [
{
"type": "object",
"x-abstract": true,
"properties": {
"Identifier": {
"type": "string",
"description": "Identifier of response",
"minLength": 1
}
}
}
]
},
{
"type": "object",
"required": [
"myPayload"
],
"properties": {
"myPayload": {
"type": "string"
}
}
}
]
}
}
},
"operationId": "MyPath",
"openapiSource": {
"summary": "My Test Path",
"responses": {
"200": {
"description": "Success",
"x-nullable": false,
"schema": {
"allOf": [
{
"allOf": [
{
"type": "object",
"x-abstract": true,
"properties": {
"Identifier": {
"type": "string",
"description": "Identifier of response",
"minLength": 1
}
}
}
]
},
{
"type": "object",
"required": [
"myPayload"
],
"properties": {
"myPayload": {
"type": "string"
}
}
}
]
}
}
}
}
} The openapiSource property is ignored by fastify. This config can easily be fed to a very simple fastify server, e.g. see: As far as I can see the schema is valid JSON schema, but somehow fastify doesn't correctly process it. One thing that might be missing is a body parameter, it could be that fastify requires an input parameter on a POST operation. I checked by changing the method to GET but still got the same schema error :-( Looking at a minimal doc that satisfies your schema {
"myPayload": "ABCDEFGH",
"Identifier": "ABCDEFGHIJKLMNOPQRSTU"
} it might be an option to simplify your schema, although I suspect that your original schema is bigger than this. I'm out of ideas for now, and I would suggest taking the simple fastify server code attached to the fastify project for feedback. Kind regards, |
Thanks for the fast reply. You point me in the right direction.
|
Hi,
I struggled a bit to get fastify running with openapi glue.
If I start the fastify server I get following error:
FST_ERR_SCH_BUILD: Failed building the schema for POST: /MyPath, due error undefined unsupported
I created a minimum repro with the attached swagger file:
-> results in described error
Maybe something is wrong with my swagger file but the online swagger editor mentioned no errors.
Can someone give me a hint what is going wrong here?
The text was updated successfully, but these errors were encountered: