99class Options extends ClassStructure
1010{
1111 /**
12- * Remove parent prefix from property name
12+ * Remove parent prefix from property name.
1313 * Example:
1414 * type Property struct { PropertySimple *PropertySimple `json:"-"`}
1515 * would become
@@ -19,25 +19,25 @@ class Options extends ClassStructure
1919 public $ trimParentFromPropertyNames = true ;
2020
2121 /**
22- * Hide properties with constant values
22+ * Hide properties with constant values.
2323 * @var bool
2424 */
2525 public $ hideConstProperties = true ;
2626
2727 /**
28- * Use integer types based on minimum/maximum
28+ * Use integer types based on minimum/maximum.
2929 * @var bool
3030 */
3131 public $ optimizeIntegers = true ;
3232
3333 /**
34- * Skip Unmarshal generation
34+ * Skip Unmarshal generation.
3535 * @var bool
3636 */
3737 public $ skipUnmarshal = false ;
3838
3939 /**
40- * Skip Marshal generation
40+ * Skip Marshal generation.
4141 * @var bool
4242 */
4343 public $ skipMarshal = false ;
@@ -108,6 +108,12 @@ class Options extends ClassStructure
108108 */
109109 public $ renames = [];
110110
111+ /**
112+ * Map of regexps to replaces, e.g. {"/Definitions([\w\d]+)JSON([\w\d]+)?/i":"${1}${2}"}.
113+ * @var array
114+ */
115+ public $ rewrites = [];
116+
111117 /**
112118 * Only generate schemas that have `x-generate: true`.
113119 * @var bool
@@ -126,11 +132,43 @@ class Options extends ClassStructure
126132 */
127133 public static function setUpProperties ($ properties , Schema $ ownerSchema )
128134 {
129- $ properties ->trimParentFromPropertyNames = Schema::boolean ()->setDefault (true );
130- $ properties ->hideConstProperties = Schema::boolean ()->setDefault (true );
131- $ properties ->skipMarshal = Schema::boolean ();
132- $ properties ->skipUnmarshal = Schema::boolean ();
135+ $ properties ->trimParentFromPropertyNames = Schema::boolean ()->setDefault (true )
136+ ->setDescription ('Remove parent prefix from property name. ' );
137+ $ properties ->hideConstProperties = Schema::boolean ()->setDefault (true )
138+ ->setDescription ('Hide properties with constant values ' );
139+ $ properties ->optimizeIntegers = Schema::boolean ()->setDefault (true )
140+ ->setDescription ('Use integer types based on minimum/maximum ' );
141+ $ properties ->skipMarshal = Schema::boolean ()
142+ ->setDescription ('Skip Marshal generation ' );
143+ $ properties ->skipUnmarshal = Schema::boolean ()
144+ ->setDescription ('Skip Unmarshal generation ' );
145+ $ properties ->ignoreXGoType = Schema::boolean ()
146+ ->setDescription ('Generate structure for schema with `x-go-type` available. ' );
147+ $ properties ->enableXNullable = Schema::boolean ()
148+ ->setDescription ('Add `null` to types if `x-nullable` or `nullable` is available. ' );
149+ $ properties ->withZeroValues = Schema::boolean ()
150+ ->setDescription ('Use pointer types to avoid zero value ambiguity. ' );
151+ $ properties ->ignoreRequired = Schema::boolean ()
152+ ->setDescription ('Ignore if property is required when deciding on pointer type or omitempty. ' );
153+ $ properties ->validateRequired = Schema::boolean ()->setDefault (true )
154+ ->setDescription ('Validate that required properties are present when unmarshaling. ' );
155+ $ properties ->ignoreNullable = Schema::boolean ()
156+ ->setDescription ('Add omitempty to nullable values. ' );
157+ $ properties ->distinctNull = Schema::boolean ()->setDefault (true )
158+ ->setDescription ('Separate `null` from non-existent key by using `*interface{}` type in property. ' );
159+ $ properties ->defaultAdditionalProperties = Schema::boolean ()->setDefault (true )
160+ ->setDescription ('Enable `additionalProperties` if they are missing (null) in schema. ' );
161+ $ properties ->inheritSchemaFromExamples = Schema::boolean ()
162+ ->setDescription ('Inherit schema from schema examples where available. ' );
163+ $ properties ->fluentSetters = Schema::boolean ()
164+ ->setDescription ('Generate fluent setters for struct fields. ' );
165+ $ properties ->renames = Schema::object ()->setAdditionalProperties (Schema::string ())
166+ ->setDescription ('Map of default exported symbol names to new ones, e.g. {"PoorlyGenerated":"NicelyReadable"}. ' );
167+ $ properties ->rewrites = Schema::object ()->setAdditionalProperties (Schema::string ())
168+ ->setDescription ('Map of regexps to replaces, e.g. {"/Definitions([\w\d]+)JSON([\w\d]+)?/i":"${1}${2}"}. ' );
169+ $ properties ->requireXGenerate = Schema::boolean ()
170+ ->setDescription ('Only generate schemas that have `x-generate: true`. ' );
171+ $ properties ->nameTags = Schema::arr ()->setItems (Schema::string ())
172+ ->setDescription ('Set additional field tags with property name. ' );
133173 }
134-
135-
136174}
0 commit comments