Skip to content

feat(core): support multiple JSONPath expressions for aliases#2016

Merged
P0lip merged 8 commits into
developfrom
feat/core/multiple-aliases
Jan 19, 2022
Merged

feat(core): support multiple JSONPath expressions for aliases#2016
P0lip merged 8 commits into
developfrom
feat/core/multiple-aliases

Conversation

@P0lip

@P0lip P0lip commented Jan 4, 2022

Copy link
Copy Markdown
Contributor

Related to https://github.com/stoplightio/platform-internal/issues/8141

Needed by #2018
Example usage

{ formats: [oas2], given: ['$.responses', '#OperationObject.responses'] },

I believe that once this one is in, we can consider the aliases frozen and won't need to make any further changes.

Checklist

  • Tests added / updated
  • Docs added / updated

Does this PR introduce a breaking change?

  • Yes
  • No

@P0lip P0lip added the enhancement New feature or request label Jan 4, 2022
@P0lip P0lip self-assigned this Jan 4, 2022
@@ -322,13 +324,69 @@ For now the JSON, YAML, and JS, are all being maintained, and there are no curre

## Aliases

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mnaumanali94 what do you think?

@P0lip P0lip force-pushed the feat/core/multiple-aliases branch from bf3ae2b to b397d16 Compare January 5, 2022 23:11
@P0lip P0lip mentioned this pull request Jan 6, 2022
4 tasks
@P0lip P0lip marked this pull request as ready for review January 6, 2022 16:06
@P0lip P0lip requested review from marbemac and mnaumanali94 January 6, 2022 16:07
Comment thread docs/guides/4-custom-rulesets.md Outdated
This is the JSON Schema definition describing aliases.
It's a superset of `given`, with the notable difference being the possibility to distinguish between different formats.

```json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure this will really be all that helpful for folks reading the docs, and might just be confusing? I'm pretty well versed with json schema, and even so it's not easy to imagine what this schema is trying to describe. The examples are much more helpful 🤷‍♂️

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

True, I might just delete it.
Do you think the examples here are sufficient or should I add a few additional ones?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think delete and good for now

Comment thread docs/guides/4-custom-rulesets.md
Comment thread docs/guides/4-custom-rulesets.md Outdated
Comment thread packages/core/src/meta/ruleset.schema.json
Comment thread packages/core/src/ruleset/rule.ts Outdated
@P0lip P0lip force-pushed the feat/core/multiple-aliases branch from d00b0b0 to f473884 Compare January 18, 2022 12:23

@marbemac marbemac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Generally looks good - however as discussed, definitely think that we should not expose/advertise the baked in aliases until we have time to really think them through.

@P0lip P0lip merged commit f1b2c2c into develop Jan 19, 2022
@P0lip P0lip deleted the feat/core/multiple-aliases branch January 19, 2022 00:55
stoplight-bot pushed a commit that referenced this pull request Jan 19, 2022
# [@stoplight/spectral-core-v1.9.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-core-v1.8.1...@stoplight/spectral-core-v1.9.0) (2022-01-19)

### Features

* **core:** support multiple JSONPath expressions for aliases ([#2016](#2016)) ([f1b2c2c](f1b2c2c))
@stoplight-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version @stoplight/spectral-core-v1.9.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@DiogoDoreto

Copy link
Copy Markdown

This PR introduced a breaking change to the aliases property. I started seeing errors like the one below after updating:

Error at #/aliases/PathItem: must be array

I'll update my code accordingly, but I'm adding this comment here to help anyone searching for this error in the future.

@P0lip

P0lip commented Feb 24, 2022

Copy link
Copy Markdown
Contributor Author

@DiogoDoreto true. I felt a bit uncomfortable releasing this change as non-breaking, as I knew this could affect a few users using it. In fact, the initial iteration of this PR was backward compatible, but having a few internal conversations we decided to make that soft breaking change.
However, rest assured it's a one-off situation, as we do try to strictly follow semantic versioning at all times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants