Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Base path missing #75

Open
danielkocot opened this issue Jul 7, 2021 · 2 comments
Open

Base path missing #75

danielkocot opened this issue Jul 7, 2021 · 2 comments

Comments

@danielkocot
Copy link

When I describe an API Spec

openapi: 3.0.3
servers:
  - url: 'http://localhost:8080/api'

the base path will be ignored. I can't anything in the documentation.

@hauner
Copy link
Member

hauner commented Jul 8, 2021

Yes, it is not used. What would be your expectation?

  • extract the /api part and add it as prefix to any endpoint path?

  • or (in case of Spring) put an @RequestMapping(path = "/api") on the generated interfaces?

  • servers allows multiple urls, we would need a way to tell the processor which one to pick:

    servers:
    - url: https://server-a/v1
    - url: https://server-b/v1234
  • it is also possible to use variables in the url and define them as additional properties of the url key. The example in the specification uses an enum for a variable, so it is possible to have multiple values. Makes sense, why use a variable if I have a single value only ;-)

    servers:
    - url: https://{var}.openapiprocessor.io:{port}/{path}
     variables:
        var:  ...
        port:  ...
        path:  ...

Looking at the possibilities, it would work only for a subset of them. For example only single url and single value for a path variable. Which would be ok for me. Hmm, maybe it would even work for more than a single url, I think the Spring annotation allows to configure multiple paths.

Questions over questions :-)

@danielkocot
Copy link
Author

danielkocot commented Jul 8, 2021

Yes, there are so many questions and possibilities. In my first reaction I wanted to put an annotation on generated interface. But now I added an annotation to the controller which implemented the api interface.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants