APIDevTools / json-schema-ref-parser

Parse, Resolve, and Dereference JSON Schema $ref pointers in Node and browsers
https://apitools.dev/json-schema-ref-parser
MIT License
956 stars 228 forks source link

MissingPointerError: Token "ABC" does not exist. #255

Closed YoungHo-Jo closed 7 months ago

YoungHo-Jo commented 2 years ago

I am having trouble with MissingPointerError issues.

What I am doing is pasring java swagger docs generated from io.swaggerfox.sprinffox-swagger2. It gives json docs from http://localhost:8080/v2/docs.

if reference contains space at the end of the $ref then causes above issue. I tested dereferencing removing that space at $ref and it succeed.

example like below

{
 "swagger": "2.0",
  ...,
 "paths": {
    "somepath": {
        "post": {
            ...,
            "parameterer": [
               {
                   "in": "body",
                   ....,
                   "schema": {
                       "ref": "#/deifinitions/ABC "
                   }
               }
            ]
        }
    } 
 }
"definitions": {
    ...,
    "ABC ": {  // tested removing space at the end of "ABC "
      "type": "object",
      "properties": {
        "abc": {
          "type": "string"
        }
      },
      "title": "ABC "
    },
  ...
  }
}
philsturgeon commented 2 years ago

Is Springfox adding that space by itself? Can we send a pull request to Springfox to fix it? Do we need to support this trailing space?

ChrisCWerner commented 2 years ago

I'm having the same issue. In my schema, there are some data that comes from clients that may or may not contain trailing spaces. When it does, the reference breaks and everything that depends on the resulting object as well.

jonluca commented 7 months ago

Fixed in 11.3.1