IBM / openapi-to-graphql

Translate APIs described by OpenAPI Specifications (OAS) into GraphQL
https://developer.ibm.com/open/projects/openapi-to-graphql/
MIT License
1.6k stars 206 forks source link

Conversion fails if there is a '#' in the url of a REST query #441

Closed juliandm closed 2 years ago

juliandm commented 2 years ago

Describe the bug I was trying to run the cli on the aws s3 api schema but got following error:

OpenAPI-to-GraphQL creation event error: expected '/{Bucket}/{Key}#uploadId' not to contain '#' (false negative fail)

To Reproduce Steps to reproduce the behavior:

  1. Download the raw aws s3 api schema https://raw.githubusercontent.com/APIs-guru/openapi-directory/main/APIs/amazonaws.com/s3/2006-03-01/openapi.yaml
  2. save it in a file test.yaml
  3. run openapi-to-graphql test.yaml
  4. See error

Expected behavior I expect it to parse

Alan-Cha commented 2 years ago

@juliandm This seems to be a good catch. I will try to take a look at this later today.

Alan-Cha commented 2 years ago

I took a look at this. This seems to be a problem with our OAS validator oas-validator. This is more evidence that we should switch to a different OAS validator.

Related: #410, #334

Alan-Cha commented 2 years ago

Huh, the interesting thing is that the maintainer of this OAS is also a maintainer of oas-validator.

Alan-Cha commented 2 years ago

I think this might be invalid according to OAS.

https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-templating

The value for these path parameters MUST NOT contain any unescaped "generic syntax" characters described by RFC3986: forward slashes (/), question marks (?), or hashes (#).

It seems like paths should not contain unescaped "#". As a result, I do not expect this should work. I will close this issue for now.