Forum Discussion

DavidThielen's avatar
DavidThielen
Occasional Contributor
5 years ago

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 ...
  • HKosova's avatar
    5 years ago

    The Type.description line has an extra quote at the end. The InnerError.description line is missing an ending quote and also has extra indent.

     

    Here's the correct version:

    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.