Skip to content

feat(rulesets): use aliases in ruleset#2018

Closed
P0lip wants to merge 3 commits into
developfrom
feat/rulesets/aliases-in-oas
Closed

feat(rulesets): use aliases in ruleset#2018
P0lip wants to merge 3 commits into
developfrom
feat/rulesets/aliases-in-oas

Conversation

@P0lip

@P0lip P0lip commented Jan 6, 2022

Copy link
Copy Markdown
Contributor

Fixes #1972

Needs #2016

Checklist

  • Tests added / updated
  • Docs added / updated

Does this PR introduce a breaking change?

  • Yes
  • No

@P0lip P0lip added the t/bug Something isn't working label Jan 6, 2022
@P0lip P0lip self-assigned this Jan 6, 2022
@P0lip P0lip added enhancement New feature or request and removed t/bug Something isn't working labels Jan 6, 2022
Base automatically changed from feat/core/multiple-aliases to develop January 19, 2022 00:55
Comment thread packages/rulesets/src/oas/index.ts Outdated
},
RequestBodyObject: ['#OperationObject.requestBody', '$.components.requestBodies[*]'],
OperationObject: '#PathItem[get,put,post,delete,options,head,patch,trace]',
SchemaObject: ['#MediaTypeObject.schema', '#ParameterObject.schema', '$.components.schemas[*]'],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Isn't this a little misleading? I mean, isn't there a possibility of a lot of schema objects embedded in properties (and embedded in properties of properties, and so on) that won't be captured here?

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.

Yeah, it's not final yet. SchemaObject will have to catch all schemas, I've got it somewhere but not committed yet

Comment thread packages/rulesets/src/oas/index.ts Outdated
"$..headers..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]",
"$..parameters..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]",
],
given: ['#SchemaObject', '#SchemaObject..[?(@ && @.example)]'],

@hudlow hudlow Feb 1, 2022

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Won't this capture components.schema.MySchema.properties if there's a property called example? Or maybe I'm missing something?

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.

It will, although the current impl does it as well.
In any case, before I mark that PR as ready to review, I'll need to figure out a way to do it. It's not that trivial using JSONPath expressions.,so I'll probably need to think of something else

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Apologies, I totally missed that this was a draft!

@P0lip P0lip force-pushed the feat/rulesets/aliases-in-oas branch from a2019f1 to db5b847 Compare March 14, 2022 11:44
@P0lip P0lip closed this Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oas3-valid-schema-example: Issue with properties called "default"?

3 participants