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

Can't silence reports #1018

Closed
m-mohr opened this issue Mar 18, 2020 · 4 comments · Fixed by #1020
Closed

Can't silence reports #1018

m-mohr opened this issue Mar 18, 2020 · 4 comments · Fixed by #1020
Labels
t/bug Something isn't working

Comments

@m-mohr
Copy link
Contributor

m-mohr commented Mar 18, 2020

Describe the bug

I just installed 5.2.0 with the new silencing feature introduced by @nulltoken. I'm trying to silence the errors I am getting for my openapi.yaml described here: #915

To start with broad example, I added

except:
  "openapi.yaml#":
    - oas3-valid-schema-example
    - oas3-valid-content-schema-example

Unfortunately, it still shows the errors. I also tried some more paths, but except for an error that the source is missing for path # nothing changed.

What I really want to achieve:

except:
  "openapi.yaml#/components/schemas/process_graph":
    - oas3-valid-schema-example
  "openapi.yaml#/paths/\/processes/get":
    - oas3-valid-content-schema-example
  "openapi.yaml#/paths/\/process_graphs/get":
    - oas3-valid-content-schema-example
  "openapi.yaml#/paths/\/service_types/get":
    - oas3-valid-content-schema-example

Although for this example I'm not sure whether the forward slashes are correctly escaped.

I'm using JSON Reference here because the example in the docs look like JSON Reference although the doc says JSON Path. I'm confused, but tried both...

To Reproduce

See #915 and add the code given above.

Expected behavior

Errors should be silent. Either I don't understand the new feature/docs and that needs improvement or there's a bug in the code.

Environment (remove any that are not applicable):

  • Library version: 5.2.0
  • OS: Windows 10
@m-mohr m-mohr added the t/bug Something isn't working label Mar 18, 2020
@nulltoken
Copy link
Contributor

@m-mohr Awesome feedback! <3

You're right, the doco may need a little love. Escaping in Json Pointer land is a little bit unwelcoming (cf. https://tools.ietf.org/html/rfc6901#section-3).

Applying those (a little bit) unfriendly rules, the ruleset should look like:

extends: spectral:oas

except:
  "openapi.yaml#/components/schemas/process_graph/example":
    - oas3-valid-schema-example
  "openapi.yaml#/paths/~1process_graphs/get/responses/200/content/application~1json/schema/example":
    - oas3-valid-content-schema-example

Which now gets correctly interpreted.

However, your use case led me to discover a bug in the code.

Using this ruleset, linting the document from https://raw.githubusercontent.com/Open-EO/openeo-api/spectral/openapi.yaml returns ... no result. Duh! The result coming from "/service_types" is swallowed 😢

I'm working on a patch. Hardest part of it should be coming with a simple repro case that I could fit into a unit test.

Stay tuned!

@P0lip I hope @stoplight-bot the release bot is unaffected by the current pandemic as we may need some help from it to issue a patch release with the fix 😜

@m-mohr
Copy link
Contributor Author

m-mohr commented Mar 19, 2020

@nulltoken Thanks! I just tried to use it with your changes from the PR. With your two except rules I got rid of two errors, but I still get two other errors:

c:/dev/openeo-api/openapi.yaml
 1730:25  error  oas3-valid-content-schema-example  can't resolve reference #/components/schemas/process_parameter from id #
 2590:25  error  oas3-valid-content-schema-example  can't resolve reference #/components/schemas/process_schema from id #

So now I'm trying with the following rules:

except:
  "openapi.yaml#/components/schemas/process_graph/example":
    - oas3-valid-schema-example
  "openapi.yaml#/paths/~1processes/get/responses/200/content/application~1json/schema/example":
    - oas3-valid-content-schema-example
  "openapi.yaml#/paths/~1process_graphs/get/responses/200/content/application~1json/schema/example":
    - oas3-valid-content-schema-example
  "openapi.yaml#/paths/~1service_types/get/responses/200/content/application~1json/schema/example":
    - oas3-valid-content-schema-example

Unfortunately, I still get the two errors and the paths are taken from the -f json output...

@nulltoken
Copy link
Contributor

Unfortunately, I still get the two errors and the paths are taken from the -f json output...

@m-mohr Wow. You're just amazing. You've found yet another bug! Working on a fix. I'll update #1020 and ping you from it when it's ready.

THANKS A TON! 😍

@m-mohr
Copy link
Contributor Author

m-mohr commented Mar 20, 2020

Glad that it helped :-) Thanks for the quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants