You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ajv schema store split from fastify server instance because schema store use other case. eg. redis, rabbitmq pub/sub or file upload etc(share $ref schema).
definitions field remove from the option so that change openapiObject.definitions to openapiObject.components.schemas
definitions is always undefined so no way to pass externalSchemas
// as-isif(schema.querystring)resolveCommonParams('query',parameters,schema.querystring,ref,openapiObject.definitions,securityIgnores.query)if(schema.body){openapiMethod.requestBody={content: {}}resolveBodyParams(openapiMethod.requestBody,schema.body,schema.consumes,ref)}if(schema.params)resolveCommonParams('path',parameters,schema.params,ref,openapiObject.definitions)if(schema.headers)resolveCommonParams('header',parameters,schema.headers,ref,openapiObject.definitions,securityIgnores.header)// TODO: need to documentation, we treat it same as the querystring// fastify do not support cookies schema in first placeif(schema.cookies)resolveCommonParams('cookie',parameters,schema.cookies,ref,openapiObject.definitions,securityIgnores.cookie)
// to-beif(schema.querystring)resolveCommonParams('query',parameters,schema.querystring,ref,openapiObject.components.schemas,securityIgnores.query)if(schema.body){openapiMethod.requestBody={content: {}}resolveBodyParams(openapiMethod.requestBody,schema.body,schema.consumes,ref)}if(schema.params)resolveCommonParams('path',parameters,schema.params,ref,openapiObject.components.schemas)if(schema.headers)resolveCommonParams('header',parameters,schema.headers,ref,openapiObject.components.schemas,securityIgnores.header)// TODO: need to documentation, we treat it same as the querystring// fastify do not support cookies schema in first placeif(schema.cookies)resolveCommonParams('cookie',parameters,schema.cookies,ref,openapiObject.components.schemas,securityIgnores.cookie)
2. resolveLocalRef function not search root scope.
* fastify document explain to $ref as a root reference
* but resolveLocalRef function don't search root scope. Only search inline scope.
The text was updated successfully, but these errors were encountered:
imjuni
changed the title
Cannot found $ref schema when using custom schema controller
Cannot pass definitions field when using openapi configuration
Nov 16, 2022
imjuni
added a commit
to imjuni/fastify-swagger
that referenced
this issue
Nov 16, 2022
Prerequisites
Fastify version
4.9.2
Plugin version
8.1.0
Node.js version
14.20.1
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Ubuntu 20.04.3 LTS
Description
Issue
Cannot found $ref schema when custom SchemaController apply on fastify server instance.
@fastify/swagger
display error message like that,Custom SchemaController
ajv schema store split from fastify server instance because schema store use other case. eg. redis, rabbitmq pub/sub or file upload etc(share $ref schema).
Analysis
definitions
field remove from the option so that changeopenapiObject.definitions
toopenapiObject.components.schemas
definitions
is alwaysundefined
so no way to pass externalSchemas2. resolveLocalRef function not search root scope.* fastify document explain to
$ref as a root reference
* but
resolveLocalRef
function don't search root scope. Only search inline scope.Steps to Reproduce
Reproducable Repo.
Use this repo.
git clone [email protected]:imjuni/maeum.git
cd maeum
npm install
npm run dev
Expected Behavior
Works with custom schemaController.
The text was updated successfully, but these errors were encountered: