-
-
Notifications
You must be signed in to change notification settings - Fork 241
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
feat(rulesets): validate oas3 runtime expressions #1608
base: develop
Are you sure you want to change the base?
feat(rulesets): validate oas3 runtime expressions #1608
Conversation
432b7d9
to
da7c072
Compare
targetVal, | ||
null, | ||
{ given: ['paths', '/path', 'get', 'responses', '200', 'links', 'link', 'parameters', 'param'] }, | ||
{ given: null, original: null, documentInventory: new DocumentInventory(doc, {} as any), rule: {} as any }, // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably don't need to bother about this todo
comment.
As a part of the V6 release, a custom function will receive some lifting here and there.
Hey again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general! Thanks!
@mnaumanali94 mind swinging by the message we use here?
I feel like some of them are a tiny bit off, but curious to hear your thoughts.
]; | ||
} | ||
|
||
function validateJsonPointer(jsonPointer: string): void | IFunctionResult[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually pretty cool util that's worth porting to our @stoplight/json
package.
We have a set of functions that deal with various json pointers scenarios, and this would be a perfect fit.
Do you mind if I port it over there, so we can use it here and elsewhere in our ecosystem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely, please feel free to do that!
I apologize for not following up sooner. This PR just slipped my mind.
export const runtimeExpression: IFunction = function (exp): void | IFunctionResult[] { | ||
// oas3 spec allows for type Any, so only validate when exp is a string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A default export is needed too.
f0b67bd
to
ca55521
Compare
Co-authored-by: Jakub Rożek <[email protected]>
Co-authored-by: Jakub Rożek <[email protected]>
Co-authored-by: Jakub Rożek <[email protected]>
Hey, folks! I'm sorry I missed the follow-ups on May 31, and I let this PR fall behind a bit. Is this still something to include in Spectral or as mentioned above, port to Please let me know if this is something on which to move forward. |
cf3ae99
to
761c65a
Compare
dc9d7f4
to
44c40e2
Compare
02ec0d4
to
84faec8
Compare
@P0lip what's the status of this PR? I think this would be a valuable change to include in Spectral. I'd be happy to help out here if any additional effort is needed |
@dpopp07 I'll try to revisit it this week! I'll let you know in case I need any help :) |
@mnaumanali94 whatcha think? |
9e92f34
to
6d09915
Compare
@P0lip following up on this again - any updates or plans to complete it? Again, happy to help bring it across the finish line if need be. Also, if you decide against merging it at all and plan to close it let me know so I can look at incorporating the changes to my own ruleset. Thanks! |
@P0lip @mnaumanali94 Any updates? At this point, it's almost a 3 year old PR 🙂 If there aren't plans to complete this work in the near-ish future, we'll plan to bring it in to our own ruleset and y'all can close this out (the PR was originally opened out of a request to include this logic in our ruleset - it fell off our priorities but now I'd like to close it out). |
It's up to @mnaumanali94 Other than the minor merge conflict, the code is ready to go and I'd love to have that rule. |
dc90b7a
to
c22f408
Compare
@P0lip @mnaumanali94 sounds good, thanks. I'll give it another week or so to hear what the plan is before I look at porting it to our own ruleset. |
@dpopp07 We're good to merge this. Lets fix the conflict and merge away |
@barrett-schonefeld We would like to move forward with this still. Please resolve conflicts so its ready to merge. |
Hey hey @dpopp07! Resolved conflicts via GitHub UI. Should be ready! |
Hey, thanks @barrett-schonefeld ! Much appreciated 🙂 @mnaumanali94 is anything else holding up this merge? |
@mnaumanali94 @P0lip any updates here? Seems like everyone is on board for having this merged but it's going to take a maintainer to bring it over the finish line |
@P0lip @mnaumanali94 @brendarearden Checking in, as a few more months have gone by. If you need help fixing the new conflicts, I can do it, but I'd like to have some confidence y'all will merge it this time. Let me know! |
Checklist
Does this PR introduce a breaking change?
Additional context
This PR validates
links.parameters
expressions against the oas3 specification for runtime expressions.Existing Test Failures
loadRuleset
, the new rule is not being loaded from theindex.json
file. I'm likely missing something obvious, but I would appreciate suggestions on what may be happening.run
. I didn't want to spend too much time trying to resolve the configuration in case this problem is the result of the above-mentioned problem.