Skip to content
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

Open API spec should include path fragment specified as --api-path parameter #779

Closed
jfbourgon opened this issue Jun 4, 2021 · 0 comments · Fixed by #792
Closed

Open API spec should include path fragment specified as --api-path parameter #779

jfbourgon opened this issue Jun 4, 2021 · 0 comments · Fixed by #792
Assignees

Comments

@jfbourgon
Copy link

jfbourgon commented Jun 4, 2021

When starting Franklin with --api-path=mypath, the content of the Open api spec document doesn't reflect that the API is available as a deeper location then the web server root. This creates invalid links when you Try them out in a swagger frontend.

Snippet of the current content of the open-api/spec.yaml (ignoring --api-path)

openapi: 3.0.3
info:
  title: Franklin
  version: 0.0.1
paths:
  /collections:
    get:
      description: A list of collections
      operationId: collections
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Json'
  /collections/{p1}:
    get:
      description: A single collection
      operationId: collectionUnique
      parameters:
      - name: p1
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Json'
        '404':
          description: not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFound'

Recommended content of the open-api/spec.yaml when --api-path is set

openapi: 3.0.3
info:
  title: Franklin
  version: 0.0.1
paths:
  /mypath/collections:
    get:
      description: A list of collections
      operationId: collections
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Json'
  /mypath/collections/{p1}:
    get:
      description: A single collection
      operationId: collectionUnique
      parameters:
      - name: p1
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Json'
        '404':
          description: not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFound'
      ...
@jfbourgon jfbourgon changed the title Open api spec should include path fragment specified as --api-path parameter Open API spec should include path fragment specified as --api-path parameter Jun 4, 2021
@jisantuc jisantuc self-assigned this Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants