oneOf in Swagger schema does not work

oneOf is supported in OpenAPI version 3 (openapi: 3.0.0), but not in Swagger version 2 (swagger: ‘2.0’). PaymentMethod: oneOf: – $ref: ‘#/components/schemas/NewPaymentMethod’ – $ref: ‘#/components/schemas/ExistPaymentMethod’ GitHub issue ref: https://github.com/OAI/OpenAPI-Specification/issues/333 For a list of changes in OpenAPI 3.0 compared to 2.0, see: https://blog.readme.io/an-example-filled-guide-to-swagger-3-2/

Is it .yaml or .yml?

The nature and even existence of file extensions is platform-dependent (some obscure platforms don’t even have them, remember) — in other systems they’re only conventional (UNIX and its ilk), while in still others they have definite semantics and in some cases specific limits on length or character content (Windows, etc.). Since the maintainers have asked … Read more

YAML Multi-Line Arrays

A YAML sequence is an array. So this is the right way to express it: key: – string1 – string2 – string3 – string4 – string5 – string6 That’s identical in meaning to: key: [‘string1’, ‘string2’, ‘string3’, ‘string4’, ‘string5’, ‘string6′] It’s also legal to split a single-line array over several lines: key: [‘string1’, ‘string2’, ‘string3’, … Read more

What is the use of the pipe symbol in YAML?

The pipe symbol at the end of a line in YAML signifies that any indented text that follows should be interpreted as a multi-line scalar value. See the YAML spec. Specifically, the pipe indicates that (except for the indentation) the scalar value should be interpreted literally in such a way that preserves newlines. Conversely, the … Read more

How to set multiple commands in one yaml file with Kubernetes?

command: [“/bin/sh”,”-c”] args: [“command one; command two && command three”] Explanation: The command [“/bin/sh”, “-c”] says “run a shell, and execute the following instructions”. The args are then passed as commands to the shell. In shell scripting a semicolon separates commands, and && conditionally runs the following command if the first succeed. In the above … Read more

Use placeholders in yaml

Context YAML version 1.2 user wishes to include variable placeholders in YAML have placeholders replaced with computed values, upon yaml.load be able to use placeholders for both YAML mapping keys and values Problem YAML does not natively support variable placeholders. Anchors and Aliases almost provide the desired functionality, but these do not work as variable … Read more