You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 25, 2024. It is now read-only.
Add kotlin generator, includes schema generation and validation (#431)
* Adds kotlin petstore sample
* Changes status to experimental
* Updates 2 configuration classes
* Converts all exceptions to kotlin
* Converts KeywordValidator and supporting classes to Kotlin
* Updates kotlin jsonschema templates and supporting classes
* Reverts java templates
* Updates AdditionalPropertiesValidator
* Updates UnsetAnyTypeJsonSchema
* Move improvemnts for kotlin code of json schema and unset anytype schema
* Updates companion object for unset any type schema
* More improvements to UnsetAnyTypeJsonSchema
* Fixes more types in UnsetAnyTypeJsonSchema1Boxed
* Updates FrozenList and FrozenMap
* Updates FrozenList/Map
* Reverts java template changes
* Fixes all of the type validator interfaces
* Updates type validator
* Updates FormatValidator
* Updates ItemsValidator
* Updates RequiredValidator
* Updates ExclusiveMaximumValidator
* Updates ExclusiveMinimumValidator
* Updates max and min items validators
* Updates Max and Min length validators
* Updates max and min properties validator
* Updates max and min validator
* Fixes some intelij warnings in the jsonschema class
* Updates AllOfValidator
* Updates anyof and oneof validators
* Updates not and unique items validators
* Updates enum + pattern validators
* Updates const and contains validator
* Updates max and min contains validators
* Updates DependentRequiredValidator + PropertyNamesValidator
* Updates DependentSchemasValidator + PatternPropertiesValidator
* Updates IfValidator + PrefixItemsValidator
* Updates ElseValidator + ThenValidator
* Updates UnevaluatedItemsValidator + UnevaluatedPropertiesValidator
* Updates AnyTypeJsonSchema
* Updates NotAnyTypeJsonSchema
* Updates BooleanJsonSchema
* Adds NullJsonSchema
* Updates StringJsonSchema
* Updates ListJsonSchema
* Updates MapJsonSchema
* Updates NumberJsonSchema
* Updates DateJsonSchema
* Updates DateTimeJsonSchema
* Updates DecimalJsonSchema
* Adds DoubleJsonSchema
* Updates FloatJsonSchema
* Updates GenericBuilder
* Uses intsAllowedForFloatDoubleFormats in Float/Double schemas
* Updates Int32JsonSchema
* Updates Int64JsonSchema
* Updates IntJsonSchema
* Updates SetMaker and UnsetAddPropsSetter
Updates UuidJsonSchema
Updates AdditionalPropertiesValidatorTest
Removes unused kotlin files in petstore
Updates the type value method interfaces and enum validators
Updates some lingering java code to kotlin
Fixes compile errors
Fixes JsonSchemaKeywordFlagsTest
Fixes JsonSchemaFactory and existing tests
FIxes CustomIsoparserTest
Updates FormatValidatorTest
Updates ItemsValidatorTest
Updates JsonSchemaTest
Updates PropertiesValidatorTest
Updates RequiredValidatorTest
Updates TypeValidatorTest
Updates AnyTypeSchemaTest
Updates ArrayTypeSchemaTest
Updates BooleanSchemaTest
Updates ListBuilderTest
Updates ListSchemaTest
Updates MapSchemaTest
Updates NullSchemaTest
Updates NumberSchemaTest
Partial updated to ObjectTypeSchemaTest kt file only
More partial updates to ObjectTypeSchemaTest kt file
Adds ObjectTypeSchemaTest
Partial update of RefBooleanSchemaTest
Updates RefBooleanSchemaTest
Stops generating api client and rest client if there are no paths in kotlin
Kotlin does not generate response sif there are not component responses or paths
Makes request body kotlin generation conditional on presence of paths or component request bodies
Conditionally generate parameters and headers packages for kotlin
303 sample regen
Conditionally generates mediatype in kotlin
Kotlin makes contenttype generation conditional
Refactors supporting file adding into one method in kotlin
Conditionally generate ApiCOnfiguration, fix artifactId warning
Conditionally generates ApiException
Makes generation of NotImplementedException conditional
Updates readme to detect no endpoints, updates readme and gradle settings to use generatorSettings
Fixes readme reference to artifactVersion
Fixes various kotlin bugs, tests now pass without generated schemas
Kotlin 303 regen, component schemas and tests deleted
Fixes object output class initialization and requiredProps and optionalProps static vars
Fixes object output class property methods
Fixes output types for kotlin
Fixes kotlin input types
Fixes of input type definitions
Removes list map and set imports
Objects import removed
Many schema generation fixes, imports property methods
Removes casts because kotlin smart casts
Many fixes for builder setter interfaces and methods
More improvements to builder setters
Fixes setters and builder classes
Fixes sealed interfaces for schemas
Updates type values
Udpates properties, moves JsonSchemaInfo higher
Partial validate fix
Adds needed schema constructors
Updates getNewInstance
Fixes broken code in validate methods
Removes PropertyEntry, more fixes
Fixes many more kotlin errors
Fixes some kotlin casting issues
Updates schema info list creation to use listOf
Updates code to use setOf
Fixes array input and output classes
Fixes schema extension of primitive json schemas
Fixes enum types
Fixes json schema enum data
Fixes defaultValue method
Fixes character escaping
Removes many unneeded semicolons
Fixes kotlin 303 tests
Kotlin 303 sample added to ci
Adds kotlin doc
Adds circleci test for kotlin
tweaks circleci file
Turns off kotlinc version printing
Checks gradle wrapper version
Updates android image
Switches image version
Changes kotlin image ot use openjdk
Removes kotlinc log
Updates wrapper invocation
Turns on test logging, forces to be rerun
* Samples and docs regen
* Kotlin 310 sample gen
* Updates dependentSchemas
* Updates dependentRequired
* Updates patternProperties
* Includes patternProperties in calculation of mapValueSchema
* Omits getKnownKeys method when additionalProperties is turned off
* Fixes value checking of lists of any type in map output getters
* Fixes output type issues for property getters
* Adds 310 kotlin test to ci
* Samples regen
* Adjusts gradlew command
* Update build file to increase the max jvm memory limit when compiling
* Removes nodaemon arg on gradle test invocation
* Adds info logging to 310 gradle test
* Adds info logging
* Increases memory to 512 mB
* Increases memory to 1 g
* Updates template default to 1g
* Readme updated
Copy file name to clipboardExpand all lines: README.md
+27-76
Original file line number
Diff line number
Diff line change
@@ -15,89 +15,40 @@ so developers can use all of those features.
15
15
16
16
Currently, the following languages/frameworks are supported:
17
17
18
-
- python (Stability: Stable)
19
-
- java (Stability: Stable)
20
-
21
-
## Join Our Community
22
-
We use a Discord server as a place to ask questions and help each other. It offers functionality very similar to Slack.
23
-
You can join us here: https://discord.gg/mHB8WEQuYQ
24
-
25
-
## Reasons To Use the Python Generator
26
-
27
-
- v3.0.0 - [v3.1.0*](#openapi-v310-support) OpenAPI Specification support
28
-
- Type hints on
29
-
- schema payload inputs in SomeSchema.validate 
30
-
- Note: to make input dictionaries TypedDicts like the Money.validate example, set additionalProperties to false in the schema in your openapi document
31
-
- schema keyword argument inputs in `SomeSchemaDict.__new__`
32
-
- accessing properties in object instances so some_val in some_val = some_inst.someKey will have the correct type hint 
33
-
- accessing array items in array instances so some_val in some_val = array_inst[0] will have the correct type hint
34
-
- endpoint inputs + responses
35
-
- Run time type checking and validation checking when:
36
-
- instantiating models
37
-
- sending to endpoints
38
-
- receiving from endpoints
39
-
- Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class
40
-
-[mypy](samples/client/petstore/python/test_python.sh) runs on sample petstore client and passes
41
-
- passing mypy tests means that this generator could be ported into compiled languages like java/kotlin/golang
42
-
-[Autogenerated thorough testing of json schema keyword features in models and endpoints](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator/tree/master/samples/client/3_0_3_unit_test/python/test) which come from the [json schema test suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite)
43
-
-[Tests are passing in CI](https://app.circleci.com/pipelines/github/openapi-json-schema-tools/openapi-json-schema-generator?branch=master)
44
-
-[Test endpoints are tagged by the relevant keyword like type/format/allOf 39 keywords and counting](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator/tree/master/samples/client/3_1_0_unit_test/python/docs/apis/tags)
45
-
- Code re-use built in from the ground up
46
-
- components/schemas/headers etc are generated as separate classes and imported when used via $ref
47
-
- Openapi spec inline schemas supported at any depth in any location
-[Openapi v3.0.3 general petstore spec, general features](src/test/resources/3_0/python/petstore_customized.yaml)
63
-
-[generated v3.1.0 unit test client sample code](samples/client/3_1_0_unit_test/python)
64
-
-[Openapi json schema v3.1.0 unit test spec](src/test/resources/3_1/unit_test_spec/3_1_0_unit_test_spec.yaml)
65
-
-[generated v3.0.3 unit test client sample code](samples/client/3_0_3_unit_test/python)
66
-
-[Openapi json schema v3.0.3 unit test spec](src/test/resources/3_0/unit_test_spec/3_0_3_unit_test_spec.yaml)
67
-
68
-
## Reasons To Use the Java Generator
69
-
70
-
- v3.0.0 - [v3.1.0](docs/generators/java.md#schema-feature) OpenAPI Specification support
71
-
- Documentation generated in the style of javadocs. Examples: [Money schema](samples/client/petstore/java/docs/components/schemas/Money.md#money1)[Pet.addPet endpoint](samples/client/petstore/java/docs/apis/tags/Pet.md#addpet)
72
-
- Sealed classes used to define endpoint responses/response bodies/validated schema payloads/request bodies
73
-
- Input types constrained for a Schema in SomeSchema.validate
74
-
- validate method can accept arbitrary List/Map/null/int/long/double/float/String json data
75
-
- Immutable List output classes generated and returned by validate for List<?> input
76
-
- Immutable Map output classes generated and returned by validate for Map<?, ?> input
77
-
- Strictly typed list input can be instantiated in client code using generated ListBuilders
78
-
- Strictly typed map input can be instantiated in client code using generated MapBuilders
79
-
- Sequential map builders are generated ensuring that required properties are set before build is invoked. Looks like:
- instantiating List output class (validation run)
85
-
- instantiating Map output class (validation run)
86
-
- Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class
87
-
- Enums classes are generated and may be input into Schema.validate or the List/MapBuilder add/setter methods
88
-
- The [Checker-Framework's](https://github.com/typetools/checker-framework) NullnessChecker and @Nullable annotations are used in the java client
89
-
- ensuring that null pointer exceptions will not happen
90
-
- Invalid (in java) property names supported like `class`, `1var`, `hi-there` etc in
91
-
- component schema names
92
-
- schema property names (a fallback setter is written in the MapBuilder)
93
-
- Generated interfaces are largely consistent with the python code
94
-
- Openapi spec inline schemas supported at any depth in any location
95
-
- Format support for: int32, int64, float, double, date, datetime, uuid
96
-
- Payload values are not coerced when validated, so a date/date-time value can pass other validations that describe the payload only as type string
97
-
- enum types are generated for enums of type string/integer/number/boolean/null
98
-
- String transmission of numbers supported with type: string, format: number
99
-
-[Autogenerated thorough testing of json schema keyword features in models and endpoints](samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas) which come from the [json schema test suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite)
100
-
-[Tests are passing in CI](https://app.circleci.com/pipelines/github/openapi-json-schema-tools/openapi-json-schema-generator?branch=master)
49
+
## Join Our Community
50
+
We use a Discord server as a place to ask questions and help each other. It offers functionality very similar to Slack.
51
+
You can join us here: https://discord.gg/mHB8WEQuYQ
101
52
102
53
And many more!
103
54
-[Docs for the java generator](docs/generators/java.md)
0 commit comments