Skip to content

Instantly share code, notes, and snippets.

@adamaltman
Last active December 5, 2022 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamaltman/ee07bf94a967926ee0e54bcd56fdcdfb to your computer and use it in GitHub Desktop.
Save adamaltman/ee07bf94a967926ee0e54bcd56fdcdfb to your computer and use it in GitHub Desktop.
For hide APIs tutorial (starter OpenAPI file)
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
Copy link
Author

@me-ydv-5
Copy link

me-ydv-5 commented Dec 5, 2022

@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