Skip to content

Detect singular example in OpenAPI 3.1 schemas (ExampleSingularDeprecation rule)#195

Merged
geemus merged 3 commits into
ota42y:masterfrom
takayamaki:pr6-example-singular-deprecation
Jul 2, 2026
Merged

Detect singular example in OpenAPI 3.1 schemas (ExampleSingularDeprecation rule)#195
geemus merged 3 commits into
ota42y:masterfrom
takayamaki:pr6-example-singular-deprecation

Conversation

@takayamaki

Copy link
Copy Markdown
Contributor

ref: #152

Continuing the OpenAPI 3.1 work from #193.

This PR adds a new SpecValidator rule:

  • OpenAPIParser::SpecValidator::Rules::ExampleSingularDeprecation

In 3.0, the singular example keyword on a Schema Object is the standard way to attach a sample value.
3.1 deprecates it in favor of the JSON Schema examples array.

The rule flags the presence of example on any schema in a 3.1 document.

# 3.1 document — flagged
schema:
  type: string
  example: ABC-123   # deprecated; use `examples: [ABC-123]

@takayamaki takayamaki marked this pull request as ready for review July 1, 2026 23:43

@geemus geemus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm, thanks!

@geemus geemus merged commit e798e2f into ota42y:master Jul 2, 2026
14 checks passed
takayamaki added a commit to takayamaki/openapi_parser that referenced this pull request Jul 4, 2026
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