JsonSchemaOptions class

Options for generating JSON Schemas.

Parameter useRefsForNestedTypes defines whether to use $ref pointing to local $defs for nested types. This setting does not apply to any types in externalTypes.

Parameter externalTypes defines the types which should always be pointed at by a $ref to an external schema (given by the values of the Map). Notice that because SchemaType is used as a key on the Map, you should only use const values as keys as SchemaType does not define equality.

Parameters startObject and endObject define whether to open/close the JSON object. For example, you can set endObject to false and then continue writing more definitions in the resulting schema object, in which case you must remember to close the JSON object with }.

See also generateJsonSchema.

Constructors

JsonSchemaOptions.new({bool startObject = true, bool endObject = true, bool nullable = false, bool useRefsForNestedTypes = true, Map<SchemaType<Object?>, String> externalTypes = const {}})
const

Properties

endObject bool
final
externalTypes Map<SchemaType<Object?>, String>
final
hashCode int
The hash code for this object.
no setterinherited
nullable bool
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startObject bool
final
useRefsForNestedTypes bool
final

Methods

copyWith({bool? startObject, bool? endObject, bool? nullable, bool? useRefsForNestedTypes, Map<SchemaType<Object?>, String>? externalTypes}) JsonSchemaOptions
forInnerType() JsonSchemaOptions
Returns a JsonSchemaOptions for use with an inner type.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited