Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined (reading 'normalized') with nested definitions #27

Open
penx opened this issue Feb 26, 2024 · 1 comment

Comments

@penx
Copy link

penx commented Feb 26, 2024

The following spec throws an error "TypeError: Cannot read properties of undefined (reading 'normalized')"

openapi: 3.0.3
info:
  version: 1.0.0
paths:
  '/example':
    post:
      parameters:
        - name: example
          schema:
            $ref: '#/definitions/DefinitionA'
      responses:
        '200':
          description: OK
          schema:
            type: string
definitions:
  DefinitionA:
    type: object
    properties:
      example:
        type: array
        items:
          $ref: '#/definitions/DefinitionB'
  DefinitionB:
    type: object
    properties:
      example:
        type: string

https://typed-openapi-astahmer.vercel.app/?input=PYBwpgdghiCWBcACAzAOgAyuQKFhAZsPNoogG5gBOAzrMBEgIwYbYhQAuAFtcaQOQB6MAA8oAWxAAbMPz6lEIYNQ7yFiqJQlgOVXiXUKAtImjiwSUROlgDhhdQDGXMOKhr7CgCSUw%2BJPwAxIIAJn54sBx0ENSCACLhEJHRAIL8dgq%2B1EoxYPqeiPwATOjochn2YU6UsCBR9EgA8gDSFYZOLm4eBRwAnuBIKjUQAObYYfgR9THyCZNJ0ykefQOIwABGAFZgjhwZIJSgVFF53YhWkjJnpCsWiJpavW2kka75BYg%2BfgHBE1PRsTm-3oACF0qQgQtoiDlv07httrt9odwJQTu91BcbNdELdBhxhiMgA

Note that this works fine:

openapi: 3.0.3
info:
  version: 1.0.0
paths:
  '/example':
    post:
      parameters:
        - name: example
          schema:
            $ref: '#/definitions/DefinitionA'
      responses:
        '200':
          description: OK
          schema:
            type: string
definitions:
  DefinitionA:
    type: object
    properties:
      example:
        type: string

https://typed-openapi-astahmer.vercel.app/?input=PYBwpgdghiCWBcACAzAOgAyuQKFhAZsPNoogG5gBOAzrMBEgIwYbYhQAuAFtcaQOQB6MAA8oAWxAAbMPz6lEIYNQ7yFiqJQlgOVXiXUKAtImjiwSUROlgDhhdQDGXMOKhr7CgCSUw%2BJPwAxIIAJn54sBx0ENSCACLhEJHRAIL8dgq%2B1EoxYPqeiPwATOjochn2YU6UsCBR9EgA8gDSFYZOLm4eBRwAnuBIKjUQAObYYfgR9THyCZNJ0ykefQOIwABGAFZgjhwZIJSgVFF53YhWkjJnpCsWiEN4I0A

@astahmer
Copy link
Owner

astahmer commented Mar 6, 2024

hey, feel free to send a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants