-
-
Save adamaltman/ee07bf94a967926ee0e54bcd56fdcdfb to your computer and use it in GitHub Desktop.
For hide APIs tutorial (starter OpenAPI file)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.1.0 | |
info: | |
title: Sample to demo remove-x-internal | |
version: 1.0.0 | |
description: | | |
This API showcases usage of the `x-internal` property and a single OpenAPI file to generate separate internal and external OAS definitions. | |
servers: | |
- url: https://ebcdea8b-433b-4fc1-83d3-ae8f77962a73.remockly.com | |
description: Mock server | |
paths: | |
/stars: | |
get: | |
operationId: getStars | |
summary: Get list of stars | |
responses: | |
200: | |
description: OK | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/star" | |
post: | |
operationId: postStars | |
summary: Register a star | |
description: This is an internal API and should not display in our external docs. | |
requestBody: | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/star" | |
components: | |
schemas: | |
star: | |
type: object | |
properties: | |
id: | |
type: string | |
name: | |
type: string | |
brightness: | |
type: object | |
properties: | |
luminosity: | |
type: number | |
magnitude: | |
type: number | |
size: | |
type: number | |
mass: | |
type: number | |
hasPlanets: | |
type: boolean |
@adamaltman thanks for the tutorial! Will x-internal
flag still work in case the property is used as a discriminator? i.e, if hasPlanet
is used as a discriminator (and let's say it has string type)? It does not seem to hide that property in that case. I do not want a different internal version, just want to not render that field in my final spec.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read the tutorial: https://redocly.com/docs/cli/guides/hide-apis/