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:
- Use something like
contentMediaType: text/plain
. This does not exactly imply anything about the text length, but would typically not be used for “short” properties likesurname
. So, it could be perused in our context. - Introduce extension attributes like
x-columns
andx-rows
. This feels out of place in an OpenAPI document. - Create a regex that allows line breaks and use it as
pattern
for the property. This only really discriminates if all single-line string properties carry apattern
that excludes newlines. So, it’s not really practical. - Define my own format as e.g.
format: multi-line
. This would work within one system, but be useless to any tool outside that system. At least it is somehow in line with other hints for correct UI representation, likeformat: date-time
orformat: password
.