Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit 3854585

Browse files
authored
Allows generators to ingest integers when type=number and format=float/double (#427)
* Adds new generate arg * Makes generatorSettings accessible in templates * Adjusts types of float and double json schemas * Adjusts the python generator templates * Adds intsAllowedForFloatDoubleFormats: true to the config files for the unit test spec clients * Samples regen * Python sample regen with generatorSettings passed in to the templates * Regenerates java sample clients * Updates docs to list generate commands, cli command name updated * generate options added to details section in main readme * Sample update
1 parent 9b468b3 commit 3854585

File tree

41 files changed

+314
-85
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+314
-85
lines changed

README.md

Lines changed: 137 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ java -jar target/openapi-json-schema-generator-cli.jar generate \
263263

264264
To get a list of **general** options available, please run `java -jar target/openapi-json-schema-generator-cli.jar help generate`
265265

266-
To get a list of PHP specified options (which can be passed to the generator with a config file via the `-c` option), please run `java -jar target/openapi-json-schema-generator-cli.jar config-help -g php`
266+
To get a list of python specified options (which can be passed to the generator with a config file via the `-c` option), please run `java -jar target/openapi-json-schema-generator-cli.jar config-help -g python`
267267

268268
## Usage
269269

@@ -305,37 +305,164 @@ SYNOPSIS
305305
[(-e <templating engine> | --engine <templating engine>)]
306306
[--enable-post-process-file]
307307
[(-g <generator name> | --generator-name <generator name>)]
308-
[--generate-alias-as-model] [--git-host <git host>]
309-
[--git-repo-id <git repo id>] [--git-user-id <git user id>]
310-
[--global-property <global properties>...] [--group-id <group id>]
308+
[--git-host <git host>] [--git-repo-id <git repo id>]
309+
[--git-user-id <git user id>] [--global-property <global properties>...]
310+
[--group-id <group id>] [--hide-generation-timestamp]
311311
[--http-user-agent <http user agent>]
312312
[(-i <spec file> | --input-spec <spec file>)]
313313
[--ignore-file-override <ignore file override location>]
314-
[--invoker-package <invoker package>]
315-
[--log-to-stderr] [--minimal-update]
314+
[--ints-allowed-for-float-double-formats]
315+
[--invoker-package <invoker package>] [--minimal-update]
316316
[--model-name-prefix <model name prefix>]
317317
[--model-name-suffix <model name suffix>]
318318
[(-o <output directory> | --output <output directory>)] [(-p <additional properties> | --additional-properties <additional properties>)...]
319319
[--package-name <package name>] [--release-note <release note>]
320-
[--remove-operation-id-prefix]
321-
[(-s | --skip-overwrite)]
320+
[--remove-enum-value-prefix] [--remove-operation-id-prefix]
321+
[(-s | --skip-overwrite)] [--skip-operation-example]
322322
[--skip-validate-spec] [--strict-spec <true/false strict behavior>]
323323
[(-t <template directory> | --template-dir <template directory>)]
324324
[(-v | --verbose)]
325+
```
326+
<details>
327+
<summary>generate OPTIONS</summary>
325328

329+
```text
326330
OPTIONS
327331
-a <authorization>, --auth <authorization>
328332
adds authorization headers when fetching the OpenAPI definitions
329333
remotely. Pass in a URL-encoded string of name:header with a comma
330334
separating multiple values
331335
332-
...... (results omitted)
336+
--api-name-suffix <api name suffix>
337+
Suffix that will be appended to all API names ('tags'). Default:
338+
Api. e.g. Pet => PetApi. Note: Only ruby, python, jaxrs generators
339+
support this feature at the moment.
340+
341+
--api-package <api package>
342+
package for generated api classes
343+
344+
--artifact-id <artifact id>
345+
artifactId in generated pom.xml. This also becomes part of the
346+
generated library's filename
347+
348+
--artifact-version <artifact version>
349+
artifact version in generated pom.xml. This also becomes part of the
350+
generated library's filename
351+
352+
-c <configuration file>, --config <configuration file>
353+
Path to configuration file. It can be JSON or YAML. If file is JSON,
354+
the content should have the format {"optionKey":"optionValue",
355+
"optionKey1":"optionValue1"...}. If file is YAML, the content should
356+
have the format optionKey: optionValue. Supported options can be
357+
different for each language. Run config-help -g {generator name}
358+
command for language-specific config options.
359+
360+
--dry-run
361+
Try things out and report on potential changes (without actually
362+
making changes).
363+
364+
-e <templating engine>, --engine <templating engine>
365+
templating engine: "handlebars"(default) or "mustache"
366+
367+
--enable-post-process-file
368+
Enable post-processing file using environment variables.
369+
370+
-g <generator name>, --generator-name <generator name>
371+
generator to use (see list command for list)
372+
373+
--git-host <git host>
374+
Git host, e.g. gitlab.com.
375+
376+
--git-repo-id <git repo id>
377+
Git repo ID, e.g. openapi-generator.
378+
379+
--git-user-id <git user id>
380+
Git user ID, e.g. openapijsonschematools.
381+
382+
--global-property <global properties>
383+
sets specified global properties (previously called 'system
384+
properties') in the format of name=value,name=value (or multiple
385+
options, each with name=value)
386+
387+
--group-id <group id>
388+
groupId in generated pom.xml
389+
390+
--hide-generation-timestamp
391+
Hides the generation timestamp when files are generated.
392+
393+
--http-user-agent <http user agent>
394+
HTTP user agent, e.g. codegen_csharp_api_client, default to
395+
'OpenAPI-Generator/{packageVersion}/{language}'
396+
397+
-i <spec file>, --input-spec <spec file>
398+
location of the OpenAPI spec, as URL or file (required if not loaded
399+
via config using -c)
400+
401+
--ignore-file-override <ignore file override location>
402+
Specifies an override location for the .openapi-generator-ignore
403+
file. Most useful on initial generation.
404+
405+
--ints-allowed-for-float-double-formats
406+
Integers are allowed in for type: number format:float/double
407+
payloads
408+
409+
--invoker-package <invoker package>
410+
root package for generated code
411+
412+
--minimal-update
413+
Only write output files that have changed.
414+
415+
--model-name-prefix <model name prefix>
416+
Prefix that will be prepended to all model names.
417+
418+
--model-name-suffix <model name suffix>
419+
Suffix that will be appended to all model names.
420+
421+
-o <output directory>, --output <output directory>
422+
where to write the generated files (current dir by default)
423+
424+
-p <additional properties>, --additional-properties <additional
425+
properties>
426+
sets additional properties that can be referenced by the mustache
427+
templates in the format of name=value,name=value. You can also have
428+
multiple occurrences of this option.
429+
430+
--package-name <package name>
431+
package for generated classes (where supported)
432+
433+
--release-note <release note>
434+
Release note, default to 'Minor update'.
435+
436+
--remove-enum-value-prefix
437+
Remove the common prefix of enum values
438+
439+
--remove-operation-id-prefix
440+
Remove prefix of operationId, e.g. config_getId => getId
441+
442+
-s, --skip-overwrite
443+
specifies if the existing files should be overwritten during the
444+
generation.
445+
446+
--skip-operation-example
447+
Skip examples defined in operations to avoid out of memory errors.
448+
449+
--skip-validate-spec
450+
Skips the default behavior of validating an input specification.
451+
452+
--strict-spec <true/false strict behavior>
453+
'MUST' and 'SHALL' wording in OpenAPI spec is strictly adhered to.
454+
e.g. when false, no fixes will be applied to documents which pass
455+
validation but don't follow the spec.
456+
457+
-t <template directory>, --template-dir <template directory>
458+
folder containing the template files
333459
334460
-v, --verbose
335461
verbose mode
336-
337462
```
338463

464+
</details>
465+
339466
You can then use the auto-generated client. The README.md is a good starting point.
340467

341468
Other generators have [samples](samples) too.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
generatorName: java
22
outputDir: samples/client/3_0_3_unit_test/java
33
inputSpec: src/test/resources/3_0/unit_test_spec/3_0_3_unit_test_spec_nopaths.yaml
4+
intsAllowedForFloatDoubleFormats: true
45
additionalProperties:
56
artifactId: unit-test-api
67
hideGenerationTimestamp: "true"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
generatorName: java
22
outputDir: samples/client/3_1_0_unit_test/java
33
inputSpec: src/test/resources/3_1/unit_test_spec/3_1_0_unit_test_spec_nopaths.yaml
4+
intsAllowedForFloatDoubleFormats: true
45
additionalProperties:
56
artifactId: unit-test-api
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
generatorName: python
22
outputDir: samples/client/3_0_3_unit_test/python
33
inputSpec: src/test/resources/3_0/unit_test_spec/3_0_3_unit_test_spec.yaml
4+
intsAllowedForFloatDoubleFormats: true
45
additionalProperties:
56
packageName: unit_test_api
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
generatorName: python
22
outputDir: samples/client/3_1_0_unit_test/python
33
inputSpec: src/test/resources/3_1/unit_test_spec/3_1_0_unit_test_spec.yaml
4+
intsAllowedForFloatDoubleFormats: true
45
additionalProperties:
56
packageName: unit_test_api

0 commit comments

Comments
 (0)