OAI / OAI/sig-lifecycle

OpenAPI 3.x: Scope of API version in servers definition too course grained?

Open
#12 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Hi, I was building a few OpenAPI 3.0 yaml files each describing a couple of paths. All path definitions are at version 1.

My server object is defined similiar to that pattern:

servers:
 - url: https://development.gigantic-server.com/v1
  description: Development server
 - url: https://production.gigantic-server.com/v1
   description: Production server 

What if I decide to change the path definition and/or the implementation of a path in a way that makes it incompatible to version 1? I would need to define a version 2 path. But certainly only for that specific path - all others should stay at version 1.

However, my server definition from above would be useless since its scope is applied to all path.

I can think of some workarounds - like e.g. putting the version number as part of the path definition or defining another yaml spec that only includes the version 2 path - but they are not really elegant and will cause other problems.

What is best practice for this - I guess quite common - scenario?
What was the intention of the spec authors to provide the above servers pattern?

Thanks!

Contributor guide

No contributing guide indexed for this repository

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

Read the OpenAPI 3.0 Servers Object definition first, then compare it with the issue's mixed path-version scenario. Done means the project has an agreed, documented best practice that explains the intended server scope and how to handle independently versioned paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.