-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
We have a bigger OpenAPI spec for which we want to publish only specific parts to Readme.com and make public.
Therefore we're trying to use the rdme openapi:reduce
function, but this breaks the resulting spec as the $ref
import paths are completely messed up (and therefore the spec doesn't validate when trying to upload).
A small section from our spec:
api.yml
:
openapi: 3.1.0
paths:
/api/dashboards/{id}:
get:
tags: [public]
summary: Receive a specific dashboard by its id.
parameters:
- in: path
name: id
schema:
type: string
required: true
description: Dashboard Id.
responses:
'200':
description: Receive a specific dashboard.
content:
application/json:
schema:
$ref: 'dashboarding.yml#/components/schemas/DashboardDefinition'
default:
description: In case any error happens.
content:
application/json:
schema:
$ref: 'common.yml#/components/schemas/ErrorResponse'
common.yml
with the ErrorResponse definition:
openapi: 3.1.0
components:
schemas:
Error:
properties:
code:
type: integer
message:
type: string
traceId:
type: string
required:
- code
- message
ErrorResponse:
type: object
properties:
error:
$ref: '#/components/schemas/Error'
required:
- error
After running rdme openapi:reduce api.yml --tag public --out api.reduced.json
, the $ref
s are messed up in different ways (full api.reduced.json
):
{
"openapi": "3.1.0",
"paths": {
"/api/dashboards/{id}": {
"get": {
"tags": [
"public"
],
"summary": "Receive a specific dashboard by its id.",
"parameters": [
{
"in": "path",
"name": "id",
"schema": {
"type": "string"
},
"required": true,
"description": "Dashboard Id."
}
],
"responses": {
"200": {
"description": "Receive a specific dashboard.",
"content": {
"application/json": {
"schema": {
"$ref": "#/paths/~1api~1dashboards~1%7Bid%7D/put/requestBody/content/application~1json/schema"
}
}
}
},
"default": {
"description": "In case any error happens.",
"content": {
"application/json": {
"schema": {
"$ref": "#/paths/~1api~1map/post/responses/default/content/application~1json/schema"
}
}
}
}
}
}
}
}
}
Metadata
Metadata
Assignees
Labels
No labels