Error in the construction of routes
See original GitHub issueHello, when using the library I found that adding the library in a project a little more advanced than the basic example for all the requests showed me an error not found, the .yaml file that I use will generate it with editor.swagger.io, the routes when I define them I place / at the beginning as in the examples that I found since I am testing openapi and I have no experience with it, and I am testing what is the difference with respect to documentation with apidoc and I found it interesting about the validation from the own documentation. Anyway, I drifted away from the topic, try moving :
new OpenApiValidator ({ apiSpecPath: spec, }). install (app)
since I assumed that it is a middleware and in effect with that I got to show the path that serves static files that I use to serve the documentation generated with apidoc, inspecting the variables I realized that the library start of each route places // instead of / and that makes the routes are not achieved, the solution I got was to replace the line 43 const openApiRoute = `$ {bp} $ {path}`;
of the file dis / openapi.spec.loader.js
as it is a temporary solution I write to you to verify, I get lost in the logic of typescript. In my project I use a dynamic load of urls, I do not know if that is the cause of the error. Thank you and apologize if you do not understand well I do not speak English and use the translator
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Thanks @Mague
` openapi: 3.0.1 info: title: Lol description: >- Welcome Enmanuel Molina contact: email: lol@gmail.com license: name: Apache 2.0 url: ‘http://www.apache.org/licenses/LICENSE-2.0.html’ version: 1.0.0 servers:
url: ‘http://localhost:3000’ tags:
name: auth description: Autentifica los datos de un usuario y genera token de acceso paths: /auth/signin: post: summary: ‘’ description: Autentifica los datos de un usuario y genera token de acceso operationId: logIn requestBody: description: Objeto de usuario necesario para logear content: application/json: schema: $ref: ‘#/components/schemas/Auth’ required: true responses: “200”: description: Default error sample response content: application/json: schema: $ref: ‘#/components/schemas/User’ “401”: description: Usuario o contraseña incorrectos content: {} default: description: unexpected error content: application/json: schema: $ref: “#/components/schemas/Error” tags: - auth components: schemas: Auth: required: - userName - pwd type: object properties: userName: type: string example: “admin” pwd: type: string example: “superman” xml: name: Auth User: type: object properties: status: type: boolean example: true id: type: integer example: 1 name: type: string example: “Enmanuel Molina” email: type: string example: “enmanueldavidmolina@gmail.com” phone: type: string example: ‘+584267257288’ xml: name: User NewAttribute: required: - name properties: name: type: string
Attribute: allOf: - $ref: “#/components/schemas/NewAttribute” - required: - id properties: id: type: integer format: int64 Error: required: - code - message properties: code: type: integer format: int32 message: type: string
`