-
Notifications
You must be signed in to change notification settings - Fork 533
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
Support Components Section in OpenAPI Standard #2920
Comments
@AkarinServer what do you think about something like that? defineRouteMeta({
openAPI: {
responses: {
200: { description: 'OK ', content: { 'application/json': { schema: { $ref: '#/components/User' } } } },
},
components: {
User: {
type: 'object',
properties: {
id: { type: 'integer' },
name: { type: 'string' },
},
}
},
},
});
export default eventHandler(async (event) => {
return { hello: 'world!' };
}); It's a POC of defineRouteMeta({
openAPI: {
responses: {
200: { description: 'OK ', content: { 'application/json': { schema: { $ref: '#/components/User' } } } },
},
},
});
export default eventHandler(async (event) => {
return { hello: 'world 2!' };
}); |
Unbelievable! That's exactly what I'm describing! I'm so impressed for your support speed!!! Thanks for your awesome job! |
Now we have to wait for the CR and PR approve 😄 |
I don't think this is a reasonable approach. In fact, interface NitroRouteMeta {
openAPI?: OperationObject;
} The type of export interface OperationObject extends Extensable {
tags?: string[];
summary?: string;
description?: string;
externalDocs?: ExternalDocumentationObject;
operationId?: string;
parameters?: (ParameterObject | ReferenceObject)[];
requestBody?: RequestBodyObject | ReferenceObject;
responses?: ResponsesObject;
callbacks?: Record<string, CallbackObject | ReferenceObject>;
deprecated?: boolean;
security?: SecurityRequirementObject[];
servers?: ServerObject[];
} As you can see, there is no field called I think it is still necessary to find an openapi generator to see how |
@laplaceliu look at that PR 💻 The |
Describe the feature
According to the OpenAPI Standard, OpenAPI should support Components function.
Before using Components:
After using components:
Hopefully can support this function soon.
Additional information
The text was updated successfully, but these errors were encountered: