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(rulesets): add validation rule for oas2 discriminator #1921

Merged
merged 1 commit into from
Nov 2, 2021

Conversation

mkistler
Copy link
Contributor

This PR adds an oas rule to check compliance with discriminator definition in OpenAPI v2.

Checklist

  • Tests added / updated
  • Docs added / updated

Does this PR introduce a breaking change?

  • Yes
  • No

If indicated yes above, please describe the breaking change(s).

Remove this quote before creating the PR.

Screenshots

If applicable, add screenshots or gifs to help demonstrate the changes. If not applicable, remove this screenshots section before creating the PR.

Additional context

Add any other context about the pull request here. Remove this section if there is no additional context.

Copy link
Contributor

@P0lip P0lip left a comment

Choose a reason for hiding this comment

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

Thanks!

import type { IFunction, IFunctionResult } from '@stoplight/spectral-core';
import { isObject } from './utils/isObject';

export const oasDiscriminator: IFunction = (schema, _opts, { path }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

@P0lip P0lip merged commit f4e172e into stoplightio:develop Nov 2, 2021
@P0lip P0lip added the enhancement New feature or request label Nov 2, 2021
stoplight-bot pushed a commit that referenced this pull request Nov 2, 2021
# [@stoplight/spectral-rulesets-v1.3.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-rulesets-v1.2.7...@stoplight/spectral-rulesets-v1.3.0) (2021-11-02)

### Features

* **rulesets:** add validation rule for oas2 discriminator ([#1921](#1921)) ([f4e172e](f4e172e))
@stoplight-bot
Copy link
Collaborator

🎉 This PR is included in version @stoplight/spectral-rulesets-v1.3.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants