'Where to define reusable subschemas in OpenAPI 3?

I'm working on OpenAPI 3 document. I have schema called CustomerInfo: that has property Address. One of the properties of Address is enum called State. How do I make State a reusable property that can be referenced in other parts of CustomerInfo ?

components:
  schemas:
   CustomerInfo:
    type: object
    properties:
      Address:
        type: object
        description: Contains the street, city, zip, and state associated with an address.
        properties:
          State:
            $ref: ''
        required:
          - Street1
          - State

I was thinking about defining a State under definitions: within CustomerInfo, but https://editor.swagger.io/ is throwing exception :

components:
  schemas:
   CustomerInfo:
    type: object
    properties:
      Address:
        type: object
        description: Contains the street, city, zip, and state associated with an address.
        properties:
          State:
            $ref: '#/components/schemas/CustomerInfo/definitions/State'
        required:
          - Street1
          - State
    definitions:
      State: ....


Solution 1:[1]

Put the schema of State under components/schemas and it can be referenced.

components:
  schemas:
    CustomerInfo:
      type: object
      properties:
        Address:
          type: object
          description: Contains the street, city, zip, and state associated with an address.
          properties:
            State:
              $ref: '#/components/schemas/State'
          required:
          - State
    State:
      type: string
      enum:
        - Alabama
        - Alaska
        - Arizona

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 aleung