Make Paths Object Optional
See original GitHub issueThe Paths Object is required to be present in the OpenAPI Object.
This makes it awkward to create an OpenAPI spec that serves as a “catalog” of reusable components. This is already a common usage pattern in OpenAPI 2.0, and we expect it will be even more common with OpenAPI 3.0, with the introduction of the Components Object, and new types of reusable definitions contained within it.
It’s possible to create a catalog file, but you have to do one of two things:
- Use JSON’s empty object syntax, because there is no explicit empty object syntax in YAML. This works, but it’s awkward, and is just a way of getting around the requirement. to have a Paths Object. Here’s a 2.0 example:
---
swagger: "2.0"
info:
version: 1.0.0
title: Uber Schema Definitions
# This is a component file, used by the Uber API specification.
# The paths property is required, so we use curly braces to denote an empty object,
# meaning there are no path items defined in this file.
paths: {}
# The definitions section contains a set of named Schema Objects. Each object
# describes a reusable data type. We refer to these using a $ref property, with a
# JSON Reference value that resolves to the definition.
definitions:
PriceEstimate:
type: object
properties:
product_id:
type: string
description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles
...
OR…
- Use a YAML or JSON file format that is not valid OpenAPI, specifically for catalog files. This means the file can’t be processed by standard OpenAPI documentation tools, code generators and other processors, if those tools include schema validation (or the equivalent). And it means we don’t have an implementation-independent standard format for catalog files.
So I would argue for making paths
optional.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:15
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Spring Optional Path Variables | Baeldung
In this tutorial, we'll learn how to make a path variable optional in Spring. First, we'll describe how Spring binds @PathVariable ...
Read more >Illustrator - Force a Compound Path - No right click ... - YouTube
In this video I will show you how to force Illustrator to create a compound path of a selected set of objects even...
Read more >React Router with optional path parameter - Stack Overflow
Can I create optional path param to the main route ? For example I need add language param to the path, and my...
Read more >Manage paths in Photoshop - Adobe Support
To create and name a path, make sure no work path is selected. Choose New Path from the Paths panel menu, or Alt-click...
Read more >pathlib — Object-oriented filesystem paths — Python 3.11.1 ...
You want to make sure that your code only manipulates paths without actually accessing the OS. In this case, instantiating one of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found
Top GitHub Comments
Well, here’s what’s weighing against that distinction:
So the question is, what’s the value of requiring the Paths object?
Please correct me if you really think those two curly braces are the only thing keeping this Pandora’s box from unleashing eternal chaos. And of course I can live with it as-is. I’m just having a hard time seeing a downside to this.
In OAS 3.1,
paths
are optional.https://github.com/OAI/OpenAPI-Specification/releases/tag/3.1.0-rc0
Can this be closed?