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

Error with taxios-generate command: Token "components" does not exist. MissingPointerError: Token "components" does not exist. #29

Closed
TeodorDre opened this issue Aug 22, 2022 · 4 comments

Comments

@TeodorDre
Copy link

taxios-generate v0.2.12

@simplesmiler Denis, hello! i'm using you library for generating types&interfaces from OpenAPI Swagger v3.0.3.
But some things goes wrong, and i don't know what to do.

Steps for reproduce:

  1. .yaml file
  2. run taxios-generate -o ./types.ts -e LibX ./swagger.yaml --skip-validation, it falls with an exception:

Token "components" does not exist. MissingPointerError: Token "components" does not exist.

But as we can see, this field exist in .yaml file. I try to debug it with changing source code, with no success. Could you please help with it? Maybe it is because of OpenAPI version?

@TeodorDre
Copy link
Author

Ask whatever you want, and thanks for your attention here!

@crutch12
Copy link
Collaborator

I think 3.0.3 is not supported (just like 3.1.0)

#18

@simplesmiler
Copy link
Owner

simplesmiler commented Aug 29, 2022

Hi!

I don't think OpenAPI version has anything to do with your issue.

Judging by the error message, there is an invalid $ref somewhere in your file. Correct ref should look something like:

$ref: '#/components/<ComponentType>/<ComponentName>'

It would really help if you could provide a sample file.

Here is a sample file that uses correct refs format:

api.yaml
openapi: 3.0.3
info:
  title: Test refs
  version: '1.0'
servers:
  - url: 'http://localhost:3000'
paths:
  /v1/users:
    get:
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/User'
components:
  schemas:
    User:
      type: object
      properties:
        name:
          type: string
      required:
        - name
      additionalProperties: false

Also strange is the fact that you see this error while running with --skip-validation, because I can only trigger it locally when running without it. Are you sure you are running with this flag?

@simplesmiler
Copy link
Owner

Closing this under assumption that the source yaml was broken.

@TeodorDre, feel free to reopen if you can provide a sample yaml that reproduces the problem.

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

3 participants