Skip to content

Commit

Permalink
[python-exp] simplify examples (#7157)
Browse files Browse the repository at this point in the history
* Adds example setting code in python-experimental with one fn setting example values

Fixes sample indentations

Handles composed schema models, object model and arraymodels

Adds brackets in arraymodel input

Sets modelName with map schemas

Removes included_schemas arguments, dicriminator examples do not include property examples

Refactors modelName into toExampleValueRecursive argument

Fixes bug where example models contained themselves

Stops using model ExampleGenerator examples because they are inconsistent with the ones in python-experimental

Uses example values if they exist

Removes single quotes from enum examples

Fixes password example

Adds commented our regex handling, commented out because it breaks

Handles AnyType schema examples

Adds x_example values for simple string properties, uses toExampleValue for all example generation

Adds examples for simple string parameters

Updates comments in toExampleValueBase

Fixes the double nested bug for AdditionalPropertiesWithArrayOfEnums

Fixes bug where NumberWithValidations had double nesting

Updates simple string examples in arrays

Fixes array string examples

Fixes example for string endpoint body example

Adds exampleFromStringOrArraySchema

Adds regex examples, pegs slf4j-version to v1.7.29 for rgxgen

Adds comment about regex seed

Updates pattern matcher to not handle ^ and $

Updates used sample values

Adds ensureQuotes

Adds ensureQuotes

Fixes double quote bug

Updates mustache file

Adds ensureQuotes to key handling

Adds modelNameToSchema map, reduces run time by using it

Fixes java tests

Regenerates python-experimental samples

Fixes python test

* Rebased on master

* Adds getModelNameToSchemaCache

* Updates toDefaultValue to not mutate schemas

* Has all dates and datetimes default and example setting use the same helper function

* Samples regenerated

* indentation tweak, removes txt from sample file
  • Loading branch information
spacether authored Aug 20, 2020
1 parent c19350b commit 866df36
Show file tree
Hide file tree
Showing 65 changed files with 1,495 additions and 436 deletions.
2 changes: 1 addition & 1 deletion modules/openapi-generator-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</profiles>

<properties>
<slf4j-version>1.7.12</slf4j-version>
<slf4j-version>1.7.29</slf4j-version>
<guava-version>26.0-jre</guava-version>
</properties>
</project>
6 changes: 6 additions & 0 deletions modules/openapi-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@
<diffutils-version>1.3.0</diffutils-version>
<guava-version>26.0-jre</guava-version>
<generex-version>1.0.2</generex-version>
<rxgen-version>1.1</rxgen-version>
<jackson-version>2.10.1</jackson-version>
<jackson-threetenbp-version>2.10.0</jackson-threetenbp-version>
<kotlin-version>1.3.60</kotlin-version>
Expand Down Expand Up @@ -373,6 +374,11 @@
<artifactId>generex</artifactId>
<version>${generex-version}</version>
</dependency>
<dependency>
<groupId>com.github.curious-odd-man</groupId>
<artifactId>rgxgen</artifactId>
<version>${rxgen-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6191,7 +6191,7 @@ public List<CodegenServerVariable> fromServerVariables(Map<String, ServerVariabl
return codegenServerVariables;
}

private void setParameterNullable(CodegenParameter parameter, CodegenProperty property) {
protected void setParameterNullable(CodegenParameter parameter, CodegenProperty property) {
if (parameter == null || property == null) {
return;
}
Expand Down
Loading

0 comments on commit 866df36

Please sign in to comment.