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

bundle does not produce schemas + circular pointers in preview-docs #545

Closed
benasher44 opened this issue Feb 3, 2022 · 2 comments
Closed

Comments

@benasher44
Copy link

benasher44 commented Feb 3, 2022

Describe the bug
Hello again! After the feedback I got in #543, I've updated our spec to successfully bundle, however I noticed that bundle isn't fully rendering the schemas. Instead, they show up as refs:

openapi: 3.0.0
info:
  version: 1.0.0
  title: Ashby API
  description: The public API for accessing resources in your Ashby instance.
  contact:
    name: Ashby Support
    url: https://app.ashbyhq.com/support
    email: support@ashbyhq.com
servers:
  - url: http://api.ashbyhq.com
tags:
  - name: ashby
paths:
  /interviewSchedule.list:
    post:
      summary: Gets all interview schedules in the organization
      operationId: interviewScheduleList
      description: A list of interview schedules
      tags:
        - pets
      parameters:
        - $ref: '#/components/parameters/cursor'
        - $ref: '#/components/parameters/syncToken'
        - $ref: '#/components/parameters/createdAfter'
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedResponse'
                  - type: object
                    required:
                      - results
                    properties:
                      results:
                        type: array
                        items:
                          $ref: '#/components/schemas/InterviewSchedule'
components:
  parameters:
    cursor:
      $ref: '#/components/parameters/cursor'
    syncToken:
      $ref: '#/components/parameters/syncToken'
    createdAfter:
      $ref: '#/components/parameters/createdAfter'
  schemas:
    cursor:
      $ref: '#/components/schemas/cursor'
    syncToken:
      $ref: '#/components/schemas/syncToken'
    BaseResponse:
      $ref: '#/components/schemas/BaseResponse'
    PaginatedResponse:
      $ref: '#/components/schemas/PaginatedResponse'
    InterviewSchedule:
      $ref: '#/components/schemas/InterviewSchedule'

Initially, I thought maybe bundle without --dereferenced is only meant to have refs everywhere, like this. So, I tried to preview-docs, and the page fails to get past the loading spinner. The following is printed in the console:

image

To Reproduce
Steps to reproduce the behavior:

  1. Given the attached multi-file openapi setup
  2. Run openapi bundle openapi.yml or openapi preview-docs openapi.yml

Expected behavior
Bundles the spec with schemas + preview-docs renders the API documentation

Logs
See above screenshot

OpenAPI definition
openapi.zip

openapi-cli Version(s)
1.0.0-beta.80

Node.js Version(s)
16.13.0

Additional context
I might be misinterpreting how bundle works vs bundle --dereferenced. Happy to file a ticket if these issues are unrelated!

@RomanHotsiy
Copy link
Member

Yes, this is a known issue and we're working on it.

As a workaround you have to remove the schemas section from your root file. All used schemas will be added there automatically.

Please track it here: #290

@benasher44
Copy link
Author

Ah okay will do thanks!

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

No branches or pull requests

2 participants