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

feat(new-rule): ibm-schema-naming-convention #627

Merged
merged 2 commits into from
Sep 11, 2023

Conversation

dpopp07
Copy link
Member

@dpopp07 dpopp07 commented Sep 7, 2023

Adds a new rule that enforces the schema naming guidelines in the API Handbook.

Specifically, the new rule checks for correctly named collection schemas, resource collection element schemas, creation/replacement schemas, and patch schemas against the name of the associated canonical schema.

PR summary

PR Checklist

General checklist

Please make sure that your PR fulfills the following requirements:

  • The commit message follows the Angular Commit Message Guidelines.
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Dependencies have been updated as needed
  • .secrets.baseline updated as needed?

Checklist for adding a new validation rule:

  • Added new validation rule definition (packages/ruleset/src/rules/*.js, index.js)
  • If necessary, added new validation rule implementation (packages/ruleset/src/functions/*.js, updated index.js)
  • Added new rule to default configuration (packages/ruleset/src/ibm-oas.js)
  • Added tests for new rule (packages/ruleset/test/*.test.js)
  • Added docs for new rule (docs/ibm-cloud-rules.md)

@dpopp07 dpopp07 requested a review from padamstx September 7, 2023 18:26
Adds a new rule that enforces the schema naming guidelines in the API Handbook.

Specifically, the new rule checks for correctly named collection schemas, resource
collection element schemas, creation/replacement schemas, and patch schemas against
the name of the associated canonical schema.

Signed-off-by: Dustin Popp <[email protected]>
@dpopp07 dpopp07 force-pushed the dp/schema-naming-conventions branch from 14b1671 to ec5b8c0 Compare September 7, 2023 19:24
Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

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

Overall looks great. Just had a few questions to consider

Co-authored-by: Phil Adams <[email protected]>
Signed-off-by: Dustin Popp <[email protected]>
@dpopp07 dpopp07 force-pushed the dp/schema-naming-conventions branch from 702f7cb to ac78dfe Compare September 8, 2023 21:43
@dpopp07 dpopp07 requested a review from padamstx September 8, 2023 21:43
@dpopp07
Copy link
Member Author

dpopp07 commented Sep 8, 2023

All comments have been addressed

Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

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

LGTM

@dpopp07 dpopp07 merged commit dd889f1 into api-symmetry Sep 11, 2023
@dpopp07 dpopp07 deleted the dp/schema-naming-conventions branch September 11, 2023 15:10
dpopp07 added a commit that referenced this pull request Oct 1, 2023
Adds a new rule that enforces the schema naming guidelines in the API Handbook.

Specifically, the new rule checks for correctly named collection schemas, resource
collection element schemas, creation/replacement schemas, and patch schemas against
the name of the associated canonical schema.

Signed-off-by: Dustin Popp <[email protected]>
Co-authored-by: Phil Adams <[email protected]>
dpopp07 added a commit that referenced this pull request Oct 2, 2023
Adds a new rule that enforces the schema naming guidelines in the API Handbook.

Specifically, the new rule checks for correctly named collection schemas, resource
collection element schemas, creation/replacement schemas, and patch schemas against
the name of the associated canonical schema.

There is one expection for creation/replacement schemas The Handbook states:

"There is an important exception to this guidance if the nature of an API is
to provide clients with full control over entire resources, with no
system-defined or immutable aspects. For such APIs, the canonical schema
itself SHOULD be used in requests to create or replace a resource."

The rule allows for the name of the canonical schema to be used for
resource-oriented POSTs and PUTs.

Signed-off-by: Dustin Popp <[email protected]>
Co-authored-by: Phil Adams <[email protected]>
dpopp07 added a commit that referenced this pull request Oct 2, 2023
Adds a new rule that enforces the schema naming guidelines in the API Handbook.

Specifically, the new rule checks for correctly named collection schemas, resource
collection element schemas, creation/replacement schemas, and patch schemas against
the name of the associated canonical schema.

There is one expection for creation/replacement schemas The Handbook states:

"There is an important exception to this guidance if the nature of an API is
to provide clients with full control over entire resources, with no
system-defined or immutable aspects. For such APIs, the canonical schema
itself SHOULD be used in requests to create or replace a resource."

The rule allows for the name of the canonical schema to be used for
resource-oriented POSTs and PUTs.

Signed-off-by: Dustin Popp <[email protected]>
Co-authored-by: Phil Adams <[email protected]>
ibm-devx-sdk pushed a commit that referenced this pull request Oct 2, 2023
# @ibm-cloud/openapi-ruleset [1.14.0](https://github.com/IBM/openapi-validator/compare/@ibm-cloud/[email protected]...@ibm-cloud/[email protected]) (2023-10-02)

### Features

* **new-rule:** ibm-api-symmetry ([#634](#634)) ([7033dbd](7033dbd))
* **new-rule:** ibm-schema-casing-convention ([#628](#628)) ([9b5dc92](9b5dc92))
* **new-rule:** ibm-schema-naming-convention ([#627](#627)) ([b82f66a](b82f66a))
ibm-devx-sdk pushed a commit that referenced this pull request Oct 2, 2023
# ibm-openapi-validator [1.14.0](https://github.com/IBM/openapi-validator/compare/[email protected]@1.14.0) (2023-10-02)

### Features

* **new-rule:** ibm-schema-naming-convention ([#627](#627)) ([b82f66a](b82f66a))

### Dependencies

* **@ibm-cloud/openapi-ruleset:** upgraded to 1.14.0
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.

2 participants