cancel
Showing results for 
Search instead for 
Did you mean: 

request operation openapi3

Highlighted
New Member

request operation openapi3

Does anyone know how to do req.swagger.operation in openapi 3?
i generated the server in nodejs with editor.swagger.io
2 REPLIES 2
Highlighted
Staff

Re: request operation openapi3

Hi @MenschenToaster 

 

The openapi3 code generated for nodejs is not longer using swagger-tool lib (the one that set swagger object into a req object), because the project does not support OAS3. So, the nodejs code is actually working with https://github.com/cdimascio/express-openapi-validator

 

and you can retrieve info from request object calling an openapi object, something like: req.openapi

Here is an example of the openapi object inside a request object:

 

 

openapi: {
    expressRoute: '/pet/findByStatus',
    openApiRoute: '/pet/findByStatus',
    pathParams: {},
    schema: {
        tags: [Array],
        summary: 'Finds Pets by status',
        description: 'Multiple status values can be provided with comma separated strings',
        operationId: 'findPetsByStatus',
        parameters: [Array],
        responses: [Object],
        security: [Array],
        'x-swagger-router-controller': 'Pet'
    }
}

 

 

 

Highlighted
Community Manager

Re: request operation openapi3

Hi @MenschenToaster! Does this answer your question? Please let us know🙂 


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video: