{8.2.0-updated} OpenAPI Parsers
The {@link oaj.oapi.OpenApiParser} class is used to convert HTTP parts back into POJOs.
The following is the previous example of a schema that defines the format of a pipe-delimited list of comma-delimited numbers (e.g.
The following code shows how the schema above can be used to parse our input into a POJO:
As a general rule, any POJO convertible from the intermediate type for the
Type | Format | Valid parameter types |
---|---|---|
binary binary-spaced |
|
|
date-time |
|
|
|
||
empty |
|
|
empty |
|
|
|
||
|
||
|
||
|
||
empty |
|
|
|
||
empty |
|
|
|
Additionally, any of the type above can also be wrapped as {@link java.util.Optional Optionals}.
For arrays, an example of "Any POJO transformable from arrays of the default types" is:
In the example above, our POJO class can be constructed from our pipe-delimited list of comma-delimited numbers:
Just like serialization, the
The following shows an example of a bean with several properties of various types.
We define the following schema again:
Then we parse our input into our POJO:
String
Note that serializing into generic
We can also parse into Maps as well:
String