Skip to content

Bug: failed to resolve a reference to inner property of an another reference #86

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

Closed
karupanerura opened this issue Oct 6, 2022 · 2 comments · Fixed by #88
Closed

Bug: failed to resolve a reference to inner property of an another reference #86

karupanerura opened this issue Oct 6, 2022 · 2 comments · Fixed by #88

Comments

@karupanerura
Copy link
Contributor

Steps To Reproduce

Failed to resolve the references following:

components:
  schemas:
    Foo: 
      type: object
      properties:
        bar:
          type: object
          properties:
            baz:
              type: string
    Bar:
      $ref: '#/components/schemas/Foo/properties/bar'
    Baz:
      $ref: '#/components/schemas/Bar/properties/baz' # failed!

The current behavior

/Users/karupanerura/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/Guard.ts:58
  return !!schema.oneOf && typeof schema.oneOf !== "boolean" && Array.isArray(schema.oneOf);
                  ^
TypeError: Cannot read properties of undefined (reading 'oneOf')
    at Object.isOneOfSchema (/Users/karupanerura/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/Guard.ts:58:19)
    at Object.convert (/Users/karupanerura/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/toTypeNode.ts:129:13)
    at createTypeNode (/Users/karupanerura/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/components/Schemas.ts:43:29)
    at /Users/karupanerura/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/components/Schemas.ts:51:19
    at Array.forEach (<anonymous>)
    at Object.generateNamespace (/Users/karupanerura/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/components/Schemas.ts:30:27)
    at Parser.initialize (/Users/karupanerura/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/Parser.ts:41:17)
    at new Parser (/Users/karupanerura/src/github.com/karupanerura/openapi-typescript-code-generator/src/internal/OpenApiTools/Parser.ts:33:10)
    at CodeGenerator.createParser (/Users/karupanerura/src/github.com/karupanerura/openapi-typescript-code-generator/src/index.ts:32:12)
    at new CodeGenerator (/Users/karupanerura/src/github.com/karupanerura/openapi-typescript-code-generator/src/index.ts:27:24)

The expected behavior

No error to resolve the referenceBaz.

@karupanerura karupanerura added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Oct 6, 2022
@Himenon Himenon removed the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Oct 6, 2022
@Himenon
Copy link
Owner

Himenon commented Oct 6, 2022

Thanks for the bug report. This seemed to be a potential bug and has been fixed.

@Himenon
Copy link
Owner

Himenon commented Oct 6, 2022

This bug fix include v0.19.1.

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

Successfully merging a pull request may close this issue.

2 participants