nazwr / swaggerhub-doc-portal

Part 2 is currently live.
https://empire-doc-portal.netlify.com/
50 stars 29 forks source link

Support for definitions in a separate file #7

Open lauradP opened 4 years ago

lauradP commented 4 years ago

Hi, nice component, congrats!

I'm trying to use it in order to document many apis. I'd like to keep some schema definitions (I'm using openapi 3.0) in a separate file but I get this error: Resolver error at paths./Module/rest/export.get.parameters.0.schema.$ref Could not resolve reference: Could not resolve pointer: /components/schemas/FileUri does not exist in document

My definition is:

openapi: 3.0.0
info:
  version: 1.0.8
  title: myModule
paths:
  /Module/rest/export:
    get:
      servers:
        - url: 'http://10.21.30.160:8080'
      parameters:
        - $ref: '#/components/parameters/metadata'
        - $ref: '#/components/parameters/media'
        - $ref: '#/components/parameters/parentId'
      responses:
        '200':
          description: the created ID
          content:
            text/plain:
              schema:
                $ref: '../common-definitions.yaml#/components/schemas/AssetId'
        '404':
          description: Not found
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '../common-definitions.yaml#/components/responses/Error'

common-definitions.yaml is in the same server (in the parent folder) and ic correctly fetched by the browser (checked in network panel).

components:
  schemas:
    AssetId:
      type: string
      pattern: '^[0-9]+'

Is there any mistake (in my definition)?

thanks, Laura