openapi

How to annotate a string property in OpenAPI as allowing multi-line text


Context: We want to control our UI as much as possible from the OpenAPI modelling of our entities.

Question: Using OpenAPI 3.1.0, is there an established way of declaring that a string property is meant to contain longer, multi-line text, and not just a short one?

E.g. we'd like to place such an annotation to properties like curriculumVitae, as opposed to surname, so that the UI knows to use a bigger text field and maybe a different layout.

Ideas that I came up with:


Solution

  • Using OpenAPI 3.1.0, is there an established way of declaring that a string property is meant to contain longer, multi-line text, and not just a short one?

    No, JSON Schema (hence OpenAPI) doesn't have any concept / notation for multi-line strings.

    edit: I think the most semantic would be your 4th option (format: multi-line) and make your tooling understand that.