swagger-api / swagger-api/swagger-parser

How do i check if a swagger/openapi file is v2 or v3?

Open
#1,237 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
867
Forks
560
Avg merge
2d 21h
Merged PRs (30d)
7

Description

Is there a utility method that takes the swagger/openapi content as input and returns the version of it?

I read the spec and know how to differentiate them but I am missing a method that returns the version so that I can decide if I want to feed the content into the V2 or the V3 parser.

I could write it myself but I think it makes sense to have such a method within the parser library - and it might be there already.

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 by checking the parser library's existing version-detection utilities and the V2 and V3 parser entry points. Compare the desired behavior with the Swagger/OpenAPI version fields; done means the utility identifies the input version so callers can select the corresponding parser.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.