Skip to content

PathItem definition misuses patternProperties #2126

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
axelcostaspena opened this issue Feb 5, 2020 · 0 comments
Closed

PathItem definition misuses patternProperties #2126

axelcostaspena opened this issue Feb 5, 2020 · 0 comments
Labels

Comments

@axelcostaspena
Copy link
Contributor

IMHO the PathItem definition abuses of the patternProperties feature. Since the list of valid Operation properties is kown and finite, I think that we should use specific properties for each one.

Advantages:

  • Defined properties help code tools to be smarter and to assist better in coding. If we define those properties specifically, editors which use an improved language completion based on schema will offer a better completion experience - IntelliJ IDEA only offers validation for this, but after improving the schema as per the PR I will attach, it does offer completion for get|put|post... - and this is the reason nº1 for this improvement.
  • Offers a clearer undesrtanding of the allowed properties when reading the schema, with plain full-matching literals instead of a regex.
  • Avoids misuse of the patternProperties feature, which IMHO is for the need to allow an open set of constrained properties matching a pattern, or for a defined huge set of properties which can be expressed in a form of a pattern.
  • Schema is ready for future diferent Operation specifications from different request methods - maybe?

Disadvantages:

  • Longer schema.
  • Somewhat repeating code.

Attaching PR immediately.

axelcostaspena added a commit to axelcostaspena/OpenAPI-Specification that referenced this issue Feb 5, 2020
Avoid misuse of `patternProperties` feature.
Fix OAI#2126
@handrews handrews added the Schema label Feb 7, 2020
axelcostaspena added a commit to axelcostaspena/OpenAPI-Specification that referenced this issue Feb 7, 2020
Avoid misuse of `patternProperties` feature.
Fix OAI#2126
@webron webron closed this as completed in 733c879 Mar 27, 2022
VenusPR added a commit to VenusPR/Api_development that referenced this issue Mar 12, 2023
notEthan pushed a commit to notEthan/scorpio that referenced this issue Dec 4, 2024
Avoid misuse of `patternProperties` feature.
Fix OAI/OpenAPI-Specification#2126

(cherry picked from commit 733c879b3a760be5d8980d065fef284bf4aa0a92)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants