Schema transformations🔗
add_fields
🔗
AddFields rewrites the definition of an object to add new fields. Note: existing fields will not be overwritten.
Usage🔗
add_object
🔗
AddObject adds a new object to a schema.
Usage🔗
anonymous_structs_to_named
🔗
AnonymousStructsToNamed turns "anonymous structs" into a named object.
Example:
```
Panel struct {
Options struct {
Title string
}
}
```
Will become:
```
Panel struct {
Options PanelOptions
}
PanelOptions struct {
Title string
}
```
Usage🔗
constant_to_enum
🔗
ConstantToEnum turns string
constants into an enum definition with a
single member.
This is useful to "future-proof" a schema where a type can have a single
value for now but is expected to allow more in the future.
Usage🔗
dataquery_identification
🔗
N/A
Usage🔗
disjunction_infer_mapping
🔗
DisjunctionInferMapping infers the discriminator field and mapping used to describe a disjunction of references. See https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/
Usage🔗
disjunction_of_anonymous_structs_to_explicit
🔗
DisjunctionOfAnonymousStructsToExplicit looks for anonymous structs used as branches of disjunctions and turns them into explicitly named types.
Usage🔗
disjunction_to_type
🔗
DisjunctionToType transforms disjunction into a struct, mapping disjunction branches to an optional and nullable field in that struct.
Example:
```
SomeType: {
type: "some-type"
}
SomeOtherType: {
type: "other-type"
}
SomeStruct: {
foo: string | bool
}
OtherStruct: {
bar: SomeType | SomeOtherType
}
```
Will become:
```
SomeType: {
type: "some-type"
}
SomeOtherType: {
type: "other-type"
}
StringOrBool: {
string: *string
bool: *string
}
SomeStruct: {
foo: StringOrBool
}
SomeTypeOrSomeOtherType: {
SomeType: *SomeType
SomeOtherType: *SomeOtherType
}
OtherStruct: {
bar: SomeTypeOrSomeOtherType
}
```
Usage🔗
disjunction_with_constant_to_default
🔗
N/A
Usage🔗
duplicate_object
🔗
DuplicateObject duplicates the source object. The duplicate is created under a different name, possibly in a different package.
Note: if the source object isn't found, this pass does nothing.
Usage🔗
entrypoint_identification
🔗
N/A
Usage🔗
fields_set_default
🔗
FieldsSetDefault sets the default value for the given fields.
Usage🔗
fields_set_not_required
🔗
FieldsSetNotRequired rewrites the definition of given fields to mark them as nullable and not required.
Usage🔗
fields_set_required
🔗
FieldsSetRequired rewrites the definition of given fields to mark them as not nullable and required.
Usage🔗
hint_object
🔗
N/A
Usage🔗
name_anonymous_struct
🔗
NameAnonymousStruct rewrites the definition of a struct field typed as an anonymous struct to instead refer to a named type.
Usage🔗
omit
🔗
Omit rewrites schemas to omit the configured objects.
Usage🔗
rename_object
🔗
N/A
Usage🔗
replace_reference
🔗
ReplaceReference replaces any usage of the From
reference by the one given in To
.
Usage🔗
retype_field
🔗
N/A
Usage🔗
retype_object
🔗
N/A
Usage🔗
schema_set_entry_point
🔗
N/A
Usage🔗
schema_set_identifier
🔗
SchemaSetIdentifier overwrites the Metadata.Identifier field of a schema.
Usage🔗
trim_enum_values
🔗
TrimEnumValues removes leading and trailing spaces from string values. It could happen when they add them by mistake in jsonschema/openapi when they define the enums
Usage🔗
unspec
🔗
Unspec removes the Kubernetes-style envelope added by kindsys.
Objects named "spec" will be renamed, using the package as new name.