OAI / OAI/OpenAPI-Specification

Why does the JSON schema for 3.0 specify patternProperties for component names but allows additional properties?

Open
#3,720 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Schema
Dominant language
Markdown
Stars
31.2k
Forks
9.2k
Avg merge
6h 37m
Merged PRs (30d)
27

Description

Discussed in https://github.com/OAI/OpenAPI-Specification/discussions/2439

Originally posted by ryankinderman January 11, 2021
I've been working on some functionality that uses the JSON schema to help validate OpenAPI schemas, and recently noticed that the 3.0 schema allows any value for {name} in /components/{component}/{name}, while the specification states that "All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$." It seems like this could have been validated automatically by simply adding additionalProperties: false to the JSON schema.

My question is: Was not including additionalProperties: false in the JSON schema for 3.0 just an accidental omission, or was there some rationale behind not doing it?

Thanks for clarifying!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the 3.0 JSON schema and compare its component-name handling with the fixed-fields section of versions/3.0.3.md, then review discussion #2439 for the rationale. Done means documenting whether allowing additional properties is intentional or identifying the precise schema/spec correction.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.