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

Improving and unifying oas ruleset #772

Closed
wants to merge 2 commits into from

Conversation

philsturgeon
Copy link
Contributor

@philsturgeon philsturgeon commented Nov 16, 2019

Fixes #725
Fixes #771

Checklist

  • Tests added / updated
  • Docs added / updated

Does this PR introduce a breaking change?

  • Yes
  • No

Trying to do this murdered my brain, but that might be because I was up until 2am trying.

Merging the rulesets is rather hard, especially as now the format detection is more important, and our tests dont have anything which trigger the rulesets. I added swagger: 2.0 or openapi: 3.0 to a bunch of them foolishly because all i had to do was force the format, which I have also done but am still getting errors.

This is further confused by the many times I had to override type or severity as setRules TypeScript demands a proper constant instead of a string like "error". Can we normalize this on setRules, delete all the overrides, and figure out the format issue?

I cannot dedicate more time to this one but its pretty bloomin close I think.

This was referenced Nov 16, 2019
formats: ["oas3"]
given: "$"
given: "$.servers"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed a few of these. We want to get as close to the field as possible to make it show the right line on Studio.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ combined with server field is fully compliant with $.servers, so we need to be careful about changing them.
The biggest difference is that a function won't be run if property matching $.servers does not exist in the document, while it'd be run if field was specified.
cc @nulltoken since you are working on that too.
I'm pretty sure src/rulesets/oas3/__tests__/api-servers.ts fails now.

Copy link
Contributor

@P0lip P0lip Nov 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That said, we could simply add given to the UI. It's not a big chunk of work for me, and I'd feel a bit safer. 😅. We're all working on a huge chunk of work around OpenAPI rulesets, hence it might be trivial to sneak a small regression in, as there is plenty of code to review.

Last but not least, feels like a good candidate to be documented? The different is quite subtle from the ruleset perspective, but the behavior does differ quite a bit IMHO.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@philsturgeon As #773 takes over this PR, would you agree to close this one and move the discussion over to #773?

cc @nulltoken since you are working on that too.
I'm pretty sure src/rulesets/oas3/tests/api-servers.ts fails now.

@P0lip I don't see it failing in #773. Or is it passing for the wrong reason? Or did I misunderstand you?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nulltoken I think the plan is to merge #773 into here then the two of you can continue to make progress over here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@philsturgeon I'm afraid this won't work as this PR is linked to a branch in the core repository. And I'm not granted with push bit in this one.

I've already cherry picked your commits in my branch and switched the base of #773 to target develop.

It should be safe to close this one and move over to #773. Your work wouldn't be lost and @P0lip and I could work there.

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, good luck!

@P0lip P0lip deleted the feat/improve-oas-rulesets branch June 21, 2020 19:11
@P0lip P0lip restored the feat/improve-oas-rulesets branch June 21, 2020 19:11
@P0lip P0lip deleted the feat/improve-oas-rulesets branch June 23, 2021 14:23
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

Successfully merging this pull request may close these issues.

Remove 'summary' field from any default rules Breaking oas rule changes
3 participants