#include <Pt/Mcp/Type.h>
Schema that accepts a type or JSON null. More...
Inherits Type.
Public Types | |
| enum | TypeId { Null = 0 , Integer = 1 , Number = 2 , String = 3 , Boolean = 4 , Object = 5 , Array = 6 } |
| JSON Schema kind of a Type. More... | |
Public Member Functions | |
| NullableType (const Type &inner) | |
| Creates a nullable wrapper around inner. | |
| ~NullableType () | |
| Destroys the nullable wrapper. | |
| const Type & | inner () const |
| Returns the wrapped schema type. | |
| void | toSchema (std::ostream &os, const std::string &description="") const override |
| Writes this nullable type as a JSON Schema object to os. | |
| TypeId | typeId () const |
| Returns the JSON Schema kind of this type. | |
NullableType wraps another Type so the schema allows null as well as that inner type. For primitives the schema uses a type array, for example {"type":["string","null"]}. For objects and arrays it uses oneOf. The inner type is not owned; it must outlive this wrapper.
|
inherited |