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: add API descriptor with API_SPECTRAL with AsyncAPI/OpenAPI support #3474

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

pjungermann
Copy link
Contributor

Add API descriptor as modified copy of the OPENAPI descriptor. Deprecate the contained linter OPENAPI_SPECTRAL.

Add .spectral.yaml as default config file to TEMPLATE/ as modified copy of .openapirc.yml with rulesets for AsyncAPI and OpenAPI (previously, only OpenAPI).

Fixes #3387

Proposed Changes

  1. Adds API_SPECTRAL as modified copy of OPENAPI_SPECTRAL.
  2. Supports AsyncAPI and OpenAPI (filenames, file contents, etc.).
  3. Uses .spectral.yaml as config filename and provides a default file at TEMPLATE/ with rulesets for AsyncAPI and OpenAPI.
  4. Deprecates OPENAPI_SPECTRAL (and therefore, OPENAPI)

Readiness Checklist

Author/Contributor

  • Add entry to the CHANGELOG listing the change and linking to the corresponding issue (if appropriate)
  • If documentation is needed for this change, has that been included in this pull request

Reviewing Maintainer

  • Label as breaking if this is a large fundamental change
  • Label as either automation, bug, documentation, enhancement, infrastructure, or performance

@@ -206,6 +206,7 @@ WORKDIR /node-deps
RUN npm --no-cache install --ignore-scripts --omit=dev \
@salesforce/cli \
typescript \
@stoplight/spectral-cli \
Copy link
Collaborator

Choose a reason for hiding this comment

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

@nvuillam idea for improvement here: sort the required packages, to not have the order changed uselessly like here.

Copy link
Member

Choose a reason for hiding this comment

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

100% agreed, can be done in another PR :)

@echoix
Copy link
Collaborator

echoix commented Apr 9, 2024

I think there's a bit of CI issues, in part with the new eslint release, so it might not get merged today, but I think it's good overall here ;)

@pjungermann
Copy link
Contributor Author

I guess I cannot make lychee happy

  Errors in README.md
  ✗ [404] https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/api_spectral.md | Failed: Network error: Not Found
  ✗ [404] https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/api.md | Failed: Network error: Not Found

as these files don't exist at the main branch, yet.

@echoix
Copy link
Collaborator

echoix commented Apr 16, 2024

However three tests for api spectral report failure : https://github.com/oxsecurity/megalinter/actions/runs/8694444485/job/23843361154#step:11:1

@nvuillam
Copy link
Member

@pjungermann test classes are failing ^^

Add API descriptor as modified copy of the OPENAPI descriptor.
Deprecate the contained linter OPENAPI_SPECTRAL.

Add `.spectral.yaml` as default config file to `TEMPLATE/`
as modified copy of `.openapirc.yml` with rulesets for
AsyncAPI and OpenAPI (previously, only OpenAPI).

Closes: oxsecurity#3387
Copy link
Collaborator

@echoix echoix left a comment

Choose a reason for hiding this comment

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

I won't merge now, since two issues on GitHub status makes the workflows on my other repo all fail since a couple hours. Now tests don't fail. The only error is the docs not yet published for the contents of this PR

@echoix
Copy link
Collaborator

echoix commented Apr 24, 2024

In fact it will take @nvuillam to force the merge later on since it is required but fails.

@pjungermann
Copy link
Contributor Author

Thank you!

@nvuillam nvuillam merged commit ced5636 into oxsecurity:main Apr 24, 2024
6 of 7 checks passed
@pjungermann pjungermann deleted the pjungermann/spectral branch May 6, 2024 23:05
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.

Support AsyncAPI linting using Spectral
3 participants