-
Notifications
You must be signed in to change notification settings - Fork 28
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
API linting implementation guideline (#1) #110
API linting implementation guideline (#1) #110
Conversation
* Create .spectral.yml * Create camara-language-avoid-telco.js * Create camara-reserved-words.js * Create camara-security-no-secrets-in-path-or-query-parameters.js * Create megalinter.yml * Create API-linting-Implementation-Guideline.md * update API linting document files with new links of files * Update API-linting-Implementation-Guideline.md * Create javalint.xml * Create .yamllint.yaml * reserved word 'enum' and 'default' are removed from reserved word array * Remove reserved words from arrays: openAPIKeywords and reservedWords" * Enable recommended option true/false for each rule. * Update log of telco rule * Update log of reserved word rule * Update log of camara-security-no-secrets-in-path-or-query-parameters.js * update custom function rule name * update rule name as per camara standards
I had to make two changes to
The problem with the "not enough spaces before comment" error was in I don't know why there was a perceived problem with the newline character in the YAML, but I didn't think it was an issue so disabled that check. |
artifacts/linting_rules/lint_function/camara-security-no-secrets-in-path-or-query-parameters.js
Outdated
Show resolved
Hide resolved
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.
Very complete guideline, thanks. We may need some versioning headers in the files if the idea is to copy this content in each repository, so subprojects can detect changes in Commonalities' artifact
function: truthy | ||
recommended: true # Set to true/false to enable/disable this rule | ||
|
||
camara-discriminator-use: |
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.
Not all usages of oneOf/anyOf are related to polymorphism, e.g. https://github.com/camaraproject/QualityOnDemand/blob/main/code/API_definitions/qod-api.yaml#L963
then: | ||
function: pattern | ||
functionOptions: | ||
match: "^\/([a-z0-9]+(-[a-z0-9]+)*)?(\/[a-z0-9]+(-[a-z0-9]+)*|\/{.+})*$" # doesn't allow /asasd{asdas}sadas pattern or not closed braces |
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.
Why not using built-in type: kebab
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.
Tested and updated PR with spectral core function kebab
* Update camara-language-avoid-telco.js Header comment added * Update camara-reserved-words.js Header comment added * Update camara-security-no-secrets-in-path-or-query-parameters.js Header comment added * Update .spectral.yml Comment header added * Update .yamllint.yaml Header comment added * Delete artifacts/linting_rules/javalint.xml By default Java is not used in API specification repositories * Update megalinter.yml Header comment extended * Update .yamllint.yaml Changes in default configuration of yamllint * Update .spectral.yml oas3-operation-security-defined rule was disabled as it do not fully support OpenIdConnect flow * Update megalinter.yml Megalinter configuration change, disable not needed linters * Update megalinter.yml Disable running spectral outside of Megalinter * Create spectral_oas_lint.yml workflow configuration to manually run CAMARA OAS rules * Update spectral_oas_lint.yml Simplification * Update .spectral.yml New functions added/modified (more granularity for descriptions) * Update .spectral.yml typo * Update API-linting-Implementation-Guideline.md Modification and reshuffling of the how-to file * Update spectral_oas_lint.yml * Update .spectral.yml Changed camara-discriminator-use severity to: hint * Update .spectral.yml oas3-server-variables commented out * Update megalinter.yml Actions checkout@v4 upload-artifact@v4
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.
/LGTM
It is initial ruleset - subject fro further refinement
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.
Tested OK within Carrier Billing and Blockchain initiatives
Custom regex including filter added for Spectral
new-lines: disable
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.
/LGTM
What type of PR is this?
What this PR does / why we need it:
This PR introduces a step-by-step process to integrate Spectral linting into the CAMARA Repository.
The integration is essential for validating the API specification design in accordance with CAMARA's API specification guidelines.
The changes encompass both source code modifications and documentation enhancements to ensure a seamless integration of Spectral linting.
Which issue(s) this PR fixes:
Fixes #15