David Thielen
David Thielen

Reputation: 32854

How do I reference the same schema as a property?

I have the following in my oas.yaml file:

components:
  schemas:
    ServiceError:
      type: object
      properties:
        Message:
          type: string
          description: "The exception message."
        ExceptionMessage:
          type: string
        Type:
          type: string
          description: "The exception type.""
        InnerError:
            $ref: '#/components/schemas/ServiceError'
             description: "If there's an inner exception, the InnerException.

    Property:
      type: object
      properties:
        Name:
          type: string
          description: Name of the property.

It does not like the line "description: "If there's an inner exception, the InnerException." and if I remove that, it does not like the line "Property:". I've tried a lot of things and nothing works. What am I not understanding?

Upvotes: 0

Views: 871

Answers (1)

Martin Hauner
Martin Hauner

Reputation: 1733

  • a description is not allowed at the $ref. See this answer.
  • Before InnnerError are two '"'. Not sure if this is just a copy paste bug.

Upvotes: 2

Related Questions