Forum Discussion

clarkk's avatar
clarkk
New Member
28 days ago

Resolver error in component schema

Hi, I'm new to swagger and trying to write a JSON but get a few errors.

Here is the first few. The component schema is already defined, so why do I get these errors?

Resolver error at paths./get/account.get.responses.200.content.application/json.schema.$ref

Could not resolve reference: Could not resolve pointer: /components/schemas/account does not exist in document

Jump to line 56

Resolver error at paths./delete/account/{id}.get.responses.200.content.application/json.schema.$ref

Could not resolve reference: Could not resolve pointer: /components/schemas/account does not exist in document

Jump to line 60

 

```

openapi: 3.0.3
info:
  title: Test
  description: Test
  contact:
    email: name@domain.com
  version: '1.0'
servers:
  - url: https://domain.com/api/v1
tags:
  - name: account
    description: Accounts
  - name: accounting
    description: Accountings
  - name: enclosure
    description: Bookkeeping
paths:
  /get/account:
    get:
      tags:
        - account
      summary: summary
      description: description
      operationId: get_account
      parameters: []
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/account'
        '404':
          description: description
  /put/account/{id}:
    post:
      tags:
        - account
      summary: summary
      description: description
      operationId: put_id_account
      parameters:
        - name: id
          in: path
          description: description
          required: true
          schema:
            type: integer
      requestBody:
        description: description
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/account'
        required: true
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/account'
        '404':
          description: description
  /put/accounting:
    post:
      tags:
        - accounting
      summary: summary
      description: description
      operationId: put_accounting
      parameters: []
      requestBody:
        description: description
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/accounting'
        required: true
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accounting'
        '404':
          description: description
  /delete/accounting/{id}:
    get:
      tags:
        - accounting
      summary: summary
      description: description
      operationId: delete_id_accounting
      parameters:
        - name: id
          in: path
          description: description
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accounting'
        '404':
          description: description
  /put/enclosure:
    post:
      tags:
        - enclosure
      summary: summary
      description: description
      operationId: put_enclosure
      parameters: []
      requestBody:
        description: description
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/enclosure'
        required: true
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/enclosure'
        '404':
          description: description
  /delete/enclosure/{id}:
    get:
      tags:
        - enclosure
      summary: summary
      description: description
      operationId: delete_id_enclosure
      parameters:
        - name: id
          in: path
          description: description
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/enclosure'
        '404':
          description: description
  /put/account:
    post:
      tags:
        - account
      summary: summary
      description: description
      operationId: put_account
      parameters: []
      requestBody:
        description: description
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/account'
        required: true
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/account'
        '404':
          description: description
  /get/accounting/{id}:
    get:
      tags:
        - accounting
      summary: summary
      description: description
      operationId: get_id_accounting
      parameters:
        - name: id
          in: path
          description: description
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accounting'
        '404':
          description: description
  /put/accounting/{id}:
    post:
      tags:
        - accounting
      summary: summary
      description: description
      operationId: put_id_accounting
      parameters:
        - name: id
          in: path
          description: description
          required: true
          schema:
            type: integer
      requestBody:
        description: description
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/accounting'
        required: true
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accounting'
        '404':
          description: description
  /get/enclosure:
    get:
      tags:
        - enclosure
      summary: summary
      description: description
      operationId: get_enclosure
      parameters: []
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/enclosure'
        '404':
          description: description
  /put/enclosure/{id}:
    post:
      tags:
        - enclosure
      summary: summary
      description: description
      operationId: put_id_enclosure
      parameters:
        - name: id
          in: path
          description: description
          required: true
          schema:
            type: integer
      requestBody:
        description: description
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/enclosure'
        required: true
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/enclosure'
        '404':
          description: description
  /get/account/{id}:
    get:
      tags:
        - account
      summary: summary
      description: description
      operationId: get_id_account
      parameters:
        - name: id
          in: path
          description: description
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/account'
        '404':
          description: description
  /delete/account/{id}:
    get:
      tags:
        - account
      summary: summary
      description: description
      operationId: delete_id_account
      parameters:
        - name: id
          in: path
          description: description
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/account'
        '404':
          description: description
  /get/accounting:
    get:
      tags:
        - accounting
      summary: summary
      description: description
      operationId: get_accounting
      parameters: []
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accounting'
        '404':
          description: description
  /get/enclosure/{id}:
    get:
      tags:
        - enclosure
      summary: summary
      description: description
      operationId: get_id_enclosure
      parameters:
        - name: id
          in: path
          description: description
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/enclosure'
        '404':
          description: description
components:
  schemas:
    account:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
    accounting:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
    enclosure:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string

```

No RepliesBe the first to reply