Skip to content

How to split requests, responses, schemas into separate files #13

@mrmeyers99

Description

@mrmeyers99

I've been able to merge paths in from multiple files, but we haven't been able to figure out how to split the requests, responses, and schemas into separate schemas. I've created a sample repo that shows what I'm trying to do, and as you can see from the github actions worfklow I get the following error:

/components/requests/helloWorldPayload/content/application~1json/schema: content replaced from /github/workspace/schemas.yaml

Here are the files that I have, but see my github link to download the code if you need it.

spec.yaml (root file)

openapi: 3.0.3
info:
  title: Test spec
  description: |-
    Test spec
  version: 1.0.0

paths:
  $inline: paths.yaml#/paths

paths.yaml

openapi: 3.0.3
info:
  title: Paths
  description: Paths
  version: 1.0.0

paths:
  /helloWorld:
    post:
      description: Say hello
      requestBody:
        $ref: "requests.yaml#/components/requests/helloWorldPayload"
      responses:
        "200":
          $ref: "responses.yaml#/components/responses/helloWorldResponse"

requests.yaml

openapi: 3.0.3
components:
  requests:
    helloWorldPayload:
      content:
        application/json:
          schema:
            $ref: "schemas.yaml#/components/schemas/helloWorldRequestSchema"

responses.yaml

openapi: 3.0.3
components:
  responses:
    helloWorldResponse:
      description: OK
      content:
        application/json:
          schema:
            $ref: 'schemas.yaml#/components/schemas/hellowWorldResponseSchema'

schemas.yaml

openapi: 3.0.1
components:
  schemas:
    helloWorldRequestSchema:
      type: object
      properties:
        name:
          type: string
          description: name

    hellowWorldResponseSchema:
      type: object
      properties:
        message:
          type: string
          description: name

Is what I'm trying to do possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions