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

Better error reporting / handling #321

Open
alex-aveva opened this issue May 10, 2024 · 1 comment
Open

Better error reporting / handling #321

alex-aveva opened this issue May 10, 2024 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@alex-aveva
Copy link

alex-aveva commented May 10, 2024

I came across rather large OpenAPI spec with over 3K of lines which had one of properties object defined incorrectly, here's example:

{
  "openapi": "3.0.1",
  "paths": {
    "/users": {
      "get": {
        "summary": "Get all users",
        "responses": {
          "200": {
            "description": "List of user object",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/User"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "User": {
        "type": "object",
        "properties": {
          "type": null
        }
      }
    }
  }
}

Nnotice that components.schemas.User.properties has type: null.

If you attempt to run npx ng-openapi-gen -i test.json error will be quite missleading:
Error on API generation from test.json: TypeError: Cannot read properties of null (reading 'description')

I wonder if it will be possible to have better error handling and perhaps show line number where JSON schema parser chocked?

@luisfpg
Copy link
Contributor

luisfpg commented Sep 6, 2024

Sorry, I'm not having any time for this project.
Except that a PR is provided, it won't be done.
Even with a PR it might take some time until I'm able to review and merge.

@luisfpg luisfpg added the help wanted Extra attention is needed label Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants