Giter Site home page Giter Site logo

openapi-json-schema-tools / openapi-json-schema-generator Goto Github PK

View Code? Open in Web Editor NEW
120.0 3.0 10.0 151.9 MB

OpenAPI JSON Schema Generator allows auto-generation of API client libraries with a focus on JSON schema given an OpenAPI document

License: Apache License 2.0

Dockerfile 0.02% Shell 1.28% Dart 0.01% Ruby 0.08% Java 57.30% Kotlin 0.01% Handlebars 39.43% Python 1.86%
hacktoberfest hacktoberfest2022 java json-schema openapi openapi-generator openapi3 python3 code-generation python

openapi-json-schema-generator's Introduction

OpenAPI JSON Schema Generator

CI Tests Apache 2.0 License

Auto generate a client sdk from your openapi 3.0.0-3.1.0 document using Openapi JSON Schema Generator. This project is a code generator that focuses on supporting all openapi and json schema features.

Overview

OpenAPI JSON Schema Generator allows auto-generation of API client libraries (SDK generation) given an OpenAPI document (3.0.0-3.1.0* are supported). This project focuses on making the output 100% compliant with openapi + JSON schema specs. The goal is to fully support everything defined in openapi + the included JSON schema specs so developers can use all of those features.

Currently, the following languages/frameworks are supported:

  • python (Stability: Stable)
  • java (Stability: Stable)

Join Our Community

We use a Discord server as a place to ask questions and help each other. It offers functionality very similar to Slack. You can join us here: https://discord.gg/mHB8WEQuYQ

Reasons To Use the Python Generator

  • v3.0.0 - v3.1.0* OpenAPI Specification support
  • Type hints on
    • schema payload inputs in SomeSchema.validate validate screen capture
      • Note: to make input dictionaries TypedDicts like the Money.validate example, set additionalProperties to false in the schema in your openapi document
    • schema keyword argument inputs in SomeSchemaDict.__new__ validate screen capture
    • accessing properties in object instances so some_val in some_val = some_inst.someKey will have the correct type hint instance properties screen capture
    • accessing array items in array instances so some_val in some_val = array_inst[0] will have the correct type hint
    • endpoint inputs + responses
  • Run time type checking and validation checking when:
    • instantiating models
    • sending to endpoints
    • receiving from endpoints
    • Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class
  • mypy runs on sample petstore client and passes
    • passing mypy tests means that this generator could be ported into compiled languages like java/kotlin/golang
  • Autogenerated thorough testing of json schema keyword features in models and endpoints which come from the json schema test suite
  • Tests are passing in CI
  • Test endpoints are tagged by the relevant keyword like type/format/allOf 39 keywords and counting
  • Code re-use built in from the ground up
    • components/schemas/headers etc are generated as separate classes and imported when used via $ref
  • Openapi spec inline schemas supported at any depth in any location
  • Format support for: int32, int64, float, double, binary, date, datetime, uuid
  • Invalid (in python) property names supported like from, 1var, hi-there etc in
    • schema property names
    • endpoint parameter names
  • 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
  • types are generated for enums of type string/integer/boolean using typing.Literal
  • String transmission of numbers supported with type: string, format: number, value can be accessed as a Decimal with schemas.as_decimal(inst)
  • Multiple content types supported for request and response bodies
  • Endpoint response always also includes the urllib3.HTTPResponse
  • Endpoint response deserialization can be skipped with the skip_deserialization argument

And many more!

Reasons To Use the Java Generator

  • v3.0.0 - v3.1.0 OpenAPI Specification support
  • Documentation generated in the style of javadocs. Examples: Money schema Pet.addPet endpoint
  • Sealed classes used to define endpoint responses/response bodies/validated schema payloads/request bodies
  • Input types constrained for a Schema in SomeSchema.validate
    • validate method can accept arbitrary List/Map/null/int/long/double/float/String json data
  • Immutable List output classes generated and returned by validate for List<?> input
  • Immutable Map output classes generated and returned by validate for Map<?, ?> input
  • Strictly typed list input can be instantiated in client code using generated ListBuilders
  • Strictly typed map input can be instantiated in client code using generated MapBuilders
    • Sequential map builders are generated ensuring that required properties are set before build is invoked. Looks like:
    • new MapBuilder().requiredA("a").requiredB("b").build()
    • new MapBuilder().requiredA("a").requiredB("b").optionalProp("c").additionalProperty("someAddProp", "d").build()
  • Run time type checking and validation when
    • validating schema payloads
    • instantiating List output class (validation run)
    • instantiating Map output class (validation run)
    • Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class
  • Enums classes are generated and may be input into Schema.validate or the List/MapBuilder add/setter methods
  • The Checker-Framework's NullnessChecker and @Nullable annotations are used in the java client
    • ensuring that null pointer exceptions will not happen
  • Invalid (in java) property names supported like class, 1var, hi-there etc in
    • component schema names
    • schema property names (a fallback setter is written in the MapBuilder)
  • Generated interfaces are largely consistent with the python code
  • Openapi spec inline schemas supported at any depth in any location
  • Format support for: int32, int64, float, double, date, datetime, uuid
  • 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
  • enum types are generated for enums of type string/integer/number/boolean/null
  • String transmission of numbers supported with type: string, format: number
  • Autogenerated thorough testing of json schema keyword features in models and endpoints which come from the json schema test suite
  • Tests are passing in CI

And many more!

Can I build here?

Yes; contributions are welcome! Submit a PR if you want to add a new server scaffold, client sdk, or documentation generator in any language.

Table of contents

Installation

Compatibility

The OpenAPI Specification has undergone 3 revisions since initial creation in 2010. The openapi-json-schema-generator project has the following compatibilities with the OpenAPI Specification:

OpenAPI JSON Schema Generator Version OpenAPI Spec compatibility
3.3.0+ 3.0.0 - 3.1.0*
3.1.0 - 3.2.1 3.0.0 - 3.1.0
1.0.0 - 3.0.0 3.0.0 - 3.0.3

OpenAPI v3.1.0 support

OpenAPI v3.1.0 specification support includes these new/updated 2020-12 json schema keywords:

  1. const: only string values are working because of bugs in swagger parser
  2. contains
  3. dependentRequired
  4. dependentSchemas
  5. else
  6. if
  7. maxContains
  8. minContains
  9. patternProperties
  10. prefixItems
  11. propertyNames
  12. then
  13. type (array of types supported in addition to one non-array value)
  14. unevaluatedItems
  15. unevaluatedProperties

Note: these features can also be seen in the generator documentation schema features

Build Projects

To build from source, you need the following installed and available in your $PATH:

After cloning the project, you can build it from source with this command:

mvn clean install

The default build contains minimal static analysis (via CheckStyle). To run your build with PMD and Spotbugs, use the static-analysis profile:

mvn -Pstatic-analysis clean install

Docker

Public Pre-built Docker images

OpenAPI JSON Schema Generator CLI Docker Image

The docker image acts as a standalone executable. It can be used as an alternative to installing via homebrew, or for developers who are unable to install Java or upgrade the installed version.

To generate code with this image, you'll need to mount a local location as a volume.

Example:

docker run --rm -v "${PWD}:/local" openapijsonschematools/openapi-json-schema-generator-cli generate \
    -i https://raw.githubusercontent.com/openapi-json-schema-tools/openapi-json-schema-generator/master/src/test/resources/3_0/petstore.yaml \
    -g python \
    -o /local/out/python

The generated code will be located under ./out/python in the current directory.

Development in docker

You can use bin/run-in-docker.sh to do all development. This script maps your local repository to /gen in the docker container. It also maps ~/.m2/repository to the appropriate container location.

To execute mvn package:

git clone https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
cd openapi-json-schema-generator
./bin/run-in-docker.sh mvn package

Build artifacts are now accessible in your working directory.

Once built, run-in-docker.sh will act as an executable for openapi-json-schema-generator-cli. To generate code, you'll need to output to a directory under /gen (e.g. /gen/out). For example:

./bin/run-in-docker.sh help # Executes 'help' command for openapi-json-schema-generator-cli
./bin/run-in-docker.sh list # Executes 'list' command for openapi-json-schema-generator-cli
./bin/run-in-docker.sh /gen/bin/python-petstore.sh  # Builds the Go client
./bin/run-in-docker.sh generate -i src/test/resources/3_0/petstore.yaml \
    -g go -o /gen/out/python-petstore -p packageName=petstore_api # generates python client, outputs locally to ./out/python-petstore
Troubleshooting

If an error like this occurs, just execute the mvn clean install -U command:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project openapi-json-schema-generator: A type incompatibility occurred while executing org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test: java.lang.ExceptionInInitializerError cannot be cast to java.io.IOException

./run-in-docker.sh mvn clean install -U

Failed to execute goal org.fortasoft:gradle-maven-plugin:1.0.8:invoke (default) on project openapi-json-schema-generator-gradle-plugin-mvn-wrapper: org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-4.7-bin.zip'

Right now: no solution for this one :|

Getting Started

To generate a python client for petstore.yaml, please run the following

git clone https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
cd openapi-json-schema-generator
mvn clean package
java -jar target/openapi-json-schema-generator-cli.jar generate \
   -i https://raw.githubusercontent.com/openapi-json-schema-tools/openapi-json-schema-generator/master/src/test/resources/3_0/petstore.yaml \
   -g python \
   -o /var/tmp/python_api_client

(if you're on Windows, replace the last command with java -jar target\openapi-json-schema-generator-cli.jar generate -i https://raw.githubusercontent.com/openapi-json-schema-tools/openapi-json-schema-generator/master/src/test/resources/3_0/petstore.yaml -g python -o c:\temp\python_api_client)

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

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

Usage

To generate a sample client library

You can build a client against the Petstore API as follows:

./bin/generate-samples.sh ./bin/generate_samples_configs/python.yaml

(On Windows, please install GIT Bash for Windows to run the command above)

This script will run the generator with this command:

java -jar target/openapi-json-schema-generator-cli.jar generate \
  -i https://raw.githubusercontent.com/openapijsonschematools/openapi-json-schema-generator/master/src/test/resources/3_0/petstore.yaml \
  -g python \
  -t src/main/resources/python \
  --additional-properties packageName=petstore_api \
  -o samples/client/petstore/python

with a number of options. The python options are documented here.

You can also get the options with the help generate command (below only shows partial results):

NAME
        openapi-json-schema-generator-cli generate - Generate code with the specified
        generator.

SYNOPSIS
        openapi-json-schema-generator-cli generate
                [(-a <authorization> | --auth <authorization>)]
                [--api-name-suffix <api name suffix>] [--api-package <api package>]
                [--artifact-id <artifact id>] [--artifact-version <artifact version>]
                [(-c <configuration file> | --config <configuration file>)] [--dry-run]
                [(-e <templating engine> | --engine <templating engine>)]
                [--enable-post-process-file]
                [(-g <generator name> | --generator-name <generator name>)]
                [--git-host <git host>] [--git-repo-id <git repo id>]
                [--git-user-id <git user id>] [--global-property <global properties>...]
                [--group-id <group id>] [--hide-generation-timestamp]
                [--http-user-agent <http user agent>]
                [(-i <spec file> | --input-spec <spec file>)]
                [--ignore-file-override <ignore file override location>]
                [--ints-allowed-for-float-double-formats]
                [--invoker-package <invoker package>] [--minimal-update]
                [--model-name-prefix <model name prefix>]
                [--model-name-suffix <model name suffix>]
                [(-o <output directory> | --output <output directory>)] [(-p <additional properties> | --additional-properties <additional properties>)...]
                [--package-name <package name>] [--release-note <release note>]
                [--remove-enum-value-prefix] [--remove-operation-id-prefix]
                [(-s | --skip-overwrite)] [--skip-operation-example]
                [--skip-validate-spec] [--strict-spec <true/false strict behavior>]
                [(-t <template directory> | --template-dir <template directory>)]
                [(-v | --verbose)]
generate OPTIONS
OPTIONS
        -a <authorization>, --auth <authorization>
            adds authorization headers when fetching the OpenAPI definitions
            remotely. Pass in a URL-encoded string of name:header with a comma
            separating multiple values

        --api-name-suffix <api name suffix>
            Suffix that will be appended to all API names ('tags'). Default:
            Api. e.g. Pet => PetApi. Note: Only ruby, python, jaxrs generators
            support this feature at the moment.

        --api-package <api package>
            package for generated api classes

        --artifact-id <artifact id>
            artifactId in generated pom.xml. This also becomes part of the
            generated library's filename

        --artifact-version <artifact version>
            artifact version in generated pom.xml. This also becomes part of the
            generated library's filename

        -c <configuration file>, --config <configuration file>
            Path to configuration file. It can be JSON or YAML. If file is JSON,
            the content should have the format {"optionKey":"optionValue",
            "optionKey1":"optionValue1"...}. If file is YAML, the content should
            have the format optionKey: optionValue. Supported options can be
            different for each language. Run config-help -g {generator name}
            command for language-specific config options.

        --dry-run
            Try things out and report on potential changes (without actually
            making changes).

        -e <templating engine>, --engine <templating engine>
            templating engine: "handlebars"(default) or "mustache"

        --enable-post-process-file
            Enable post-processing file using environment variables.

        -g <generator name>, --generator-name <generator name>
            generator to use (see list command for list)

        --git-host <git host>
            Git host, e.g. gitlab.com.

        --git-repo-id <git repo id>
            Git repo ID, e.g. openapi-generator.

        --git-user-id <git user id>
            Git user ID, e.g. openapijsonschematools.

        --global-property <global properties>
            sets specified global properties (previously called 'system
            properties') in the format of name=value,name=value (or multiple
            options, each with name=value)

        --group-id <group id>
            groupId in generated pom.xml

        --hide-generation-timestamp
            Hides the generation timestamp when files are generated.

        --http-user-agent <http user agent>
            HTTP user agent, e.g. codegen_csharp_api_client, default to
            'OpenAPI-Generator/{packageVersion}/{language}'

        -i <spec file>, --input-spec <spec file>
            location of the OpenAPI spec, as URL or file (required if not loaded
            via config using -c)

        --ignore-file-override <ignore file override location>
            Specifies an override location for the .openapi-generator-ignore
            file. Most useful on initial generation.

        --ints-allowed-for-float-double-formats
            Integers are allowed in for type: number format:float/double
            payloads

        --invoker-package <invoker package>
            root package for generated code

        --minimal-update
            Only write output files that have changed.

        --model-name-prefix <model name prefix>
            Prefix that will be prepended to all model names.

        --model-name-suffix <model name suffix>
            Suffix that will be appended to all model names.

        -o <output directory>, --output <output directory>
            where to write the generated files (current dir by default)

        -p <additional properties>, --additional-properties <additional
        properties>
            sets additional properties that can be referenced by the mustache
            templates in the format of name=value,name=value. You can also have
            multiple occurrences of this option.

        --package-name <package name>
            package for generated classes (where supported)

        --release-note <release note>
            Release note, default to 'Minor update'.

        --remove-enum-value-prefix
            Remove the common prefix of enum values

        --remove-operation-id-prefix
            Remove prefix of operationId, e.g. config_getId => getId

        -s, --skip-overwrite
            specifies if the existing files should be overwritten during the
            generation.

        --skip-operation-example
            Skip examples defined in operations to avoid out of memory errors.

        --skip-validate-spec
            Skips the default behavior of validating an input specification.

        --strict-spec <true/false strict behavior>
            'MUST' and 'SHALL' wording in OpenAPI spec is strictly adhered to.
            e.g. when false, no fixes will be applied to documents which pass
            validation but don't follow the spec.

        -t <template directory>, --template-dir <template directory>
            folder containing the template files

        -v, --verbose
            verbose mode

You can then use the auto-generated client. The README.md is a good starting point.

Other generators have samples too.

Customization

Please refer to customization.md on how to customize the output (e.g. package name, version)

Workflow Integration

Please refer to integration.md on how to integrate OpenAPI generator with Maven, Gradle, Github and CI/CD.

License Information

The OpenAPI JSON Schema Generator project is intended as a benefit for users of the Open API Specification. The project itself has the License as specified. In addition, please understand the following points:

  • The templates included with this project are subject to the License.
  • Generated code is intentionally not subject to the parent project license

When code is generated from this project, it shall be considered AS IS and owned by the user of the software. There are no warranties--expressed or implied--for generated code. You can do what you wish with it, and once generated, the code is your responsibility and subject to the licensing terms that you deem appropriate.

Companies/Projects using OpenAPI JSON Schema Generator

Github code search

About Us

This repo is based on v6.2.0 of OpenAPI Generator. This project focuses on making the output 100% compliant with JSON schema as part of the OpenAPI 3.1 specification with a focus on complex cases (top-down approach). The goal is to fully support everything defined in JSON schema so that developers can leverage JSON schema as well as OpenAPI specification in their API design. Building here allows for more rapid progress supporting new features in OpenAPI 3.X without having to support many older generators which don't use the new features.

History of OpenAPI JSON Schema Generator

OpenAPI JSON Schema Generator is based on OpenAPI Generator v6.2.0. The project was created here because the openapi-generator core team required the removal of the python generator from their project. The author of the python generator (@spacether) preferred to keep building in the openapi-generator repo, but core team refused to consider keeping python in openapi-generator. Below is a timeline of those events and some of their reasons:

Timeline of python generator development

Removal Reasons

  • Core team and @wing328 felt adoption of the python client was reduced from 5.0.0 and onward due to python-prior + python generators
  • Some python users in the community did not prefer the new python code
  • The fact that other users + companies are using it does not warrant keeping it in the repo
  • The fact that it is more fully passing json schema tests (including the feature keywords oneOf/anyOf/allOf/additionalProperties) does not warrant keeping it in the repo
  • The openapi-generator core team refused to consider the option of keeping the python generator as another generator option in their repo, and building another python generator that looks more conventional and making that generator primary

License


Copyright 2023 OpenAPI-Json-Schema-Generator Contributors Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) Copyright 2018 SmartBear Software

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


openapi-json-schema-generator's People

Contributors

4brunu avatar ackintosh avatar arnested avatar casualjim avatar cbornet avatar deepak-michael avatar dependabot[bot] avatar epaul avatar etherealjoy avatar fehguy avatar geekerzp avatar guohuang avatar ityuhui avatar jfcote avatar jfiala avatar jimschubert avatar jmini avatar jonschoning avatar karismann avatar kuhnroyal avatar richardwhiuk avatar sebastien-rosset avatar shyri avatar spacether avatar sullis avatar vrolijkx avatar webron avatar wing328 avatar xhh avatar ybelenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

openapi-json-schema-generator's Issues

[BUG] Invalid function names based on strings containing # and digits

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Invalid function names are generated from enum string values resembling "#367B9C".

openapi-generator version

latest via docker CLI

OpenAPI declaration file content or url

Minimal reproduction: gist, validated with vacuum

Generation Details

docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:latest generate --global-property skipFormModel=false -i /local/color-names.json -g python -o /local/openapi-client

Steps to reproduce

After generating, install generated code and run pytest.

Output:

openapi-client\test\test_paths\test_sample_json\test_post.py:15: in <module>
    from openapi_client.paths.sample_json import post  # noqa: E501
E     File "C:\Users\Work\Code\openapi-generator-repros\openapi-client\openapi_client\paths\sample_json\post.py", line 90
E       def 67B9C(cls):
E            ^
E   SyntaxError: invalid decimal literal

Original bug from: OpenAPITools/openapi-generator#13942

mvn clean package issue + project installation question

Description

I previously use openapi-generator until v7.0.0 decommissioned the python client generator

I am new to opeanpi-json-schema-generator (previously used openapi-generator) and attempted the following to install based on the README:

Getting Started

I used:

git clone https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
cd openapi-json-schema-generator
mvn clean package

This resulted in the following error:

[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   URLPathUtilsTest.testGetServerURLWithVariables:115 expected [https://{user}.example.com/v1] but found [http://localhost]
[INFO]
[ERROR] Tests run: 463, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  36.743 s
[INFO] Finished at: 2023-08-25T16:20:21-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.1.2:test (default-test) on project openapi-json-schema-generator-cli: There are test failures.
[ERROR]
[ERROR] Please refer to /{local_pathway}/openapi-json-schema-generator/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Install Jar directly from maven.org

Within the README, "You can also download the JAR (latest release) directly from maven.org"

โฌ†๏ธ This link above does not exist (404) โฌ†๏ธ . In maven.org, I could not search for openapi-json-schema-generator-cli. Does this exist?

openapi-generator version

v3.0.0

OpenAPI declaration file content or url

N/A

Command line used for generation

N/A

Steps to reproduce

N/A

Related issues/PRs

N/A

Suggest a fix/enhancement
  • Will a v3.0.0 of the JAR be uploaded to maven.org?

[BUG] add default response handling

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request
Description

If there is only a default response, it should be used when deserializing
If there is a 200 and a default, the default should be used when deserializing non-200 responses

openapi-json-schema-generator version
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix

[BUG] multipart/form-data Content-Disposition missing

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When uploading a file with content type multipart/form-data the Content-Disposition part is missing.

Expected:

-----------------------------31264598498482450412031672804
Content-Disposition: form-data; name="file"; filename="test.txt"
Content-Type: text/plain

Hello World
-----------------------------31264598498482450412031672804--

Actual:

--3332f21c28498ce486e94b8ec5a48291
Content-Type: application/octet-stream

Hello World
--3332f21c28498ce486e94b8ec5a48291--
openapi-generator version

6.2.1

OpenAPI declaration file content or url
{
    "openapi": "3.0.1",
    "info": {},
    "servers": [],
    "security": [],
    "paths": {
        ...,
        "/files/{fileContainerId}/payload": {
            "post": {
                "tags": [
                    "file"
                ],
                "description": "Upload a new file",
                "operationId": "createFile",
                "parameters": [
                    {
                        "name": "fileContainerId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "format": "int64"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "file"
                                ],
                                "type": "object",
                                "properties": {
                                    "file": {
                                        "type": "string",
                                        "description": "File which you want to upload",
                                        "format": "binary"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "created"
                    },
                    "404": {
                        "description": "not found"
                    }
                }
            }
        },
        ...
    },
    "components": {...}
}
Generation Details
... generate -i target/openapi/openapi.json -g python -o clients/python
Steps to reproduce
Related issues/PRs
Suggest a fix

Note: duplicated from OpenAPITools/openapi-generator#13887

[REQ] Add support for ranged response codes 1XX ..

Is your feature request related to a problem? Please describe.

Add support for ranged response codes 1XX ..

Describe the solution you'd like

To get this working one will need to:

  • first check if the response code is in the defined set of explicit codes like 202 404 etc
  • then check if the response matches any defined wildcard responses, like 2XX 3XX
  • then use a fallback default response if it exists

I am exposing the needed info:

  • defaultResonse
  • statusCodeResponses 202, 404 etc
  • wildcardCodeResponses 2, 3, etc

In this PR: #97
which will make it easy to add this feature later.

Describe alternatives you've considered

Additional context

This issue was created by:
OpenAPITools/openapi-generator#14090

[REQ] restructure endpoint data to allow components/X imports

Is your feature request related to a problem? Please describe.

Header + Response
parameters have schema or content.mediaType.schema

And parameter names must be unique for (location + name)

So one needs a form like:
Only request and response bodies use contenttype for ParamNameOrContentType
{Request/ResponseFor{status}}{Query/Cookie/Header/Path/Body}{{ParamNameOrContentType}}Schema

  • RequestQueryStatusSchema
  • RequestBodyApplicationJsonSchema
  • ResponseFor200HeaderStatusSchema

Without this, schemas could collide
Another solution is to make the parent instances into classes, and have the schema definitions inline
That is more complicated

The more complicated solution is preferred because one should be able to$ref shared definition components that define RequestBodies/Parameters/Responses/Headers
This restructuring will also allow schemas to be inherited from PathItem parameters

Describe the solution you'd like

Describe alternatives you've considered

Additional context

[BUG] Property access of required properties does not always work

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request
Description
openapi-json-schema-generator version
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs

Created from: OpenAPITools/openapi-generator#13896 (comment)

Suggest a fix

Write a property method for each required property

[BUG] Routes generated with Headers and no content results in TypeErrors

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When generating a client from a spec that includes responses with no content and headers the generated code has type errors and cannot be used. Attempting to import an api results in the following output.

>>> from openapi_client.apis.tags import project_api
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/lberhane-meskel/WorkRepos/openapi/openapi_client/apis/tags/project_api.py", line 12, in <module>
    from openapi_client.paths.projects.post import CreateProject
  File "/Users/lberhane-meskel/WorkRepos/openapi/openapi_client/paths/projects/post.py", line 109, in <module>
    class ApiResponseFor201(api_client.ApiResponse):
  File "/Users/lberhane-meskel/.pyenv/versions/3.8.7/lib/python3.8/dataclasses.py", line 1019, in dataclass
    return wrap(cls)
  File "/Users/lberhane-meskel/.pyenv/versions/3.8.7/lib/python3.8/dataclasses.py", line 1011, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
  File "/Users/lberhane-meskel/.pyenv/versions/3.8.7/lib/python3.8/dataclasses.py", line 925, in _process_class
    _init_fn(flds,
  File "/Users/lberhane-meskel/.pyenv/versions/3.8.7/lib/python3.8/dataclasses.py", line 502, in _init_fn
    raise TypeError(f'non-default argument {f.name!r} '
TypeError: non-default argument 'headers' follows default argument
openapi-generator version

6.2.1

OpenAPI declaration file content or url

https://gist.github.com/LeulBM/07fc708a6466de98af5fcee0cf47d97a

Generation Details

openapi-generator generate -g python -i spec.yaml

Steps to reproduce
  1. Generate client using above command
  2. Attempt to import the api
    from openapi_client.apis.tags import artifact_api
Suggest a fix

The issue seems to have to do with responses that have headers and no content, such as the 200 response at 98 in the spec file.

Copied from OpenAPITools/openapi-generator#14267
Thank you for filing it @LeulBM

[BUG] Required property not in properties refers to nonexistant definition

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Adding a requirement on a sibling field in an allOf breaks the model import

openapi-generator version

6.2.0

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  title: test
  version: 1.0.0
paths:
  /:
    get:
      responses:
        200:
          description: "OK"
components:
  schemas:
    Test:
      type: object
      properties:
        test:
          type: string
    TestRequired:
      allOf:
        - $ref: '#/components/schemas/Test'
        - type: object
          required: [test]
          properties:
            name:
              type: string
Generation Details

openapi-generator-cli generate -g python -i test.yaml -o out

Steps to reproduce

Generate the client then try to import the generated "TestRequired" class. It will fail with an Error AttributeError: type object 'properties' has no attribute 'test'

The generated class is the following

# coding: utf-8

"""
    test

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)  # noqa: E501

    The version of the OpenAPI document: 1.0.0
    Generated by: https://openapi-generator.tech
"""

from datetime import date, datetime  # noqa: F401
import decimal  # noqa: F401
import functools  # noqa: F401
import io  # noqa: F401
import re  # noqa: F401
import typing  # noqa: F401
import typing_extensions  # noqa: F401
import uuid  # noqa: F401

import frozendict  # noqa: F401

from openapi_client import schemas  # noqa: F401


class TestRequired(
    schemas.ComposedSchema,
):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """


    class MetaOapg:
        
        
        class all_of_1(
            schemas.DictSchema
        ):
        
        
            class MetaOapg:
                required = {
                    "test",
                }
                
                class properties:
                    name = schemas.StrSchema
                    __annotations__ = {
                        "name": name,
                    }
            
            test: schemas.AnyTypeSchema
            
            @typing.overload
            def __getitem__(self, name: typing_extensions.Literal["name"]) -> MetaOapg.properties.name: ...
            
            @typing.overload
            def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ...
            
            def __getitem__(self, name: typing.Union[typing_extensions.Literal["name", ], str]):
                # dict_instance[name] accessor
                return super().__getitem__(name)
            
            
            @typing.overload
            def get_item_oapg(self, name: typing_extensions.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ...
            
            @typing.overload
            def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ...
            
            def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["name", ], str]):
                return super().get_item_oapg(name)
            
        
            def __new__(
                cls,
                *args: typing.Union[dict, frozendict.frozendict, ],
                test: typing.Union[MetaOapg.properties.test, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ],
                name: typing.Union[MetaOapg.properties.name, str, schemas.Unset] = schemas.unset,
                _configuration: typing.Optional[schemas.Configuration] = None,
                **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes],
            ) -> 'all_of_1':
                return super().__new__(
                    cls,
                    *args,
                    test=test,
                    name=name,
                    _configuration=_configuration,
                    **kwargs,
                )
        
        @classmethod
        @functools.lru_cache()
        def all_of(cls):
            # we need this here to make our import statements work
            # we must store _composed_schemas in here so the code is only run
            # when we invoke this method. If we kept this at the class
            # level we would get an error because the class level
            # code would be run when this module is imported, and these composed
            # classes don't exist yet because their module has not finished
            # loading
            return [
                Test,
                cls.all_of_1,
            ]


    def __new__(
        cls,
        *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ],
        _configuration: typing.Optional[schemas.Configuration] = None,
        **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes],
    ) -> 'TestRequired':
        return super().__new__(
            cls,
            *args,
            _configuration=_configuration,
            **kwargs,
        )

from openapi_client.model.test import Test

the constructor of all_of_1 expects a required test argument whose typing is based on properties which doesn't contain it.

Suggest a fix

Add typing for required parameters not existing in properties as AnyTypeSchema

Copied from: OpenAPITools/openapi-generator#13676

[REQ] Improve endpoint type hint, body type should depend upon content_type input

Is your feature request related to a problem? Please describe.

Improve endpoint type hint, body type should depend upon content_type input

Describe the solution you'd like

  • if there is only one content type, then the type hint for body should be correct without it
  • when content_type is passed in, the type hint for body should be correct

Describe alternatives you've considered

Additional context

[BUG] ThisSchema.additionalProperties = ThisSchema causes StackOverflowError

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

ThisSchema.additionalProperties = ThisSchema causes StackOverflowError
When an object schema defines additionalProperties as itself we get a StackOverflowError
Sample spec

    Player:
      type: object
      description: a model that includes a self reference this forces properties and additionalProperties
                   to be lazy loaded in python models because the Player class has not fully loaded when defining
                   properties + additionalProperties
      properties:
        name:
          type: string
        enemyPlayer:
          $ref: '#/components/schemas/Player'
      additionalProperties:
        $ref: '#/components/schemas/Player'

This bug probably also exists for ArrayModels containing themself in items

openapi-generator version
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix

The overflow happens when creating example values for schemas. Build in the ability to detect a cycle where we return to a previously visited schema and and halt in teExampleValueRecursive

[BUG] Data model is lost for python generator when http code is not in 2XX

Description

In the endpoint.handlebar , if the http code is not in the 2xx range, an exception is thrown:
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/python/endpoint.handlebars#L395

The ApiException implementation only keeps the http message as a plain binary string:
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/python/exceptions.handlebars#L93

From here on, the model corresponding to the OpenAPI schema of the response in case of a 5xx code for example, is lost.

Is this on purpose? Or maybe I'm doing something wrong ?

Copied from OpenAPITools/openapi-generator#14088
thank you @lsoica

[BUG] [python] type number constraints minimum/maximum fields on type string cause bad Python code

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request
Description

Including minimum and maximum fields on a property of type: string causes the Python code to be bad. Unfortunately, there is not WARNING during the generation. However, you see errors at runtime.

openapi-json-schema-generator version

Not sure if this ever worked, but I see the issue on v6.2.0.

OpenAPI declaration file content or url
openapi: 3.0.1

servers:
  - url: http://localhost:8080
info:
  title: Foo service
  license: 
    name: None
    url: http://foo.com
  description: Example of issue with string type with min/max values
  version: 1.0.0-SNAPSHOT
security: []

paths:
  /sna/foo:
    get:
      summary: Get info about foo
      operationId: getFoo
      responses: 
        '200':
          $ref: "#/components/responses/FooResponse"
        '4XX': 
          $ref: "#/components/responses/ErrorResponse"
        '5XX': 
          $ref: "#/components/responses/ErrorResponse"

components: 
  schemas: 
    ErrorInfo:
      description: Details about an error that occurred
      type: object
      properties:
        message:
          description: Details for the error conditon.
          type: string
        error_code:
          description: HTTP response code error
          type: integer
  
    FooInfo:
      description: Foo information
      type: object
      properties:
        name:
          description: Name of Foo
          type: string
        size:
          description: Size in bytes of the file
          type: string
          maximum: 100
          minimum: 25
        other:
          description: The type of file as determined by location
          type: string
      required: 
        - name
        - size
        
  responses:
    ErrorResponse:
      description: Error information response
      content:
        application/json:
          schema: 
            $ref: "#/components/schemas/ErrorInfo"
  
    FooResponse:
      description: File meta-data info response
      content: 
        application/json:
          schema: 
            $ref: "#/components/schemas/FooInfo"

The error in the spec is that FooInfo.size is of type=string and has minimum and maximum fields.

Generation Details

NOTE: below was translated from a container command, so it may not be perfect

openapi-generator-cli generate -i foo_service.yaml -g python -o foo_service  --additional-properties=packageName=foo_service_client,packageVersion=1.0.0-SNAPSHOT,enumUnknownDefaultCase=true,supportAsync=false
Steps to reproduce

I wrote the following Python code to demonstrate.

#!/usr/bin/env python3
from foo_service_client import ApiClient
from foo_service_client import Configuration
from foo_service_client.apis.tags.default_api import DefaultApi

def example(hostaddr: str = "http://127.0.0.1:8080", debug: bool = True):
    config = Configuration(host=hostaddr)
    config.debug = debug
    api_client = ApiClient(config)
    api = DefaultApi(api_client)

    resp = api.get_foo()
    return

if __name__ == "__main__":
    example()

Once this program is run, I see the following:

./example.py 
Traceback (most recent call last):
  File "./example.py", line 4, in <module>
    from foo_service_client.apis.tags.default_api import DefaultApi
  File "/home/rwporter/.local/lib/python3.6/site-packages/foo_service_client/apis/tags/default_api.py", line 12, in <module>
    from foo_service_client.paths.sna_foo.get import GetFoo
  File "/home/rwporter/.local/lib/python3.6/site-packages/foo_service_client/paths/sna_foo/get.py", line 29, in <module>
    from foo_service_client.model.foo_info import FooInfo
  File "/home/rwporter/.local/lib/python3.6/site-packages/foo_service_client/model/foo_info.py", line 54
    other = schemas.StrSchema
    ^
IndentationError: expected an indented block
Related issues/PRs
Suggest a fix

I would be happy if the generator fails during generation with an actionable error message. This is a mistake in my OAS that took a while to try and fix.

[REQ] Add support for pattern global flag

Is your feature request related to a problem? Please describe.

Add support for pattern global flag

Describe the solution you'd like

When the global flag is used in a spec file, something like re.findall should be used in python rather than re.match
An example of the global flag is here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/global

json schema regex flags are stored in codegenSchema.patternInfo.flags so one could detect the presence of "g" in there and use re.findall rather than re.match

Describe alternatives you've considered

Additional context

[REQ] Add deserialized responses for redirects

Is your feature request related to a problem? Please describe.

Redirections are currently treated as errors
They should be returned back as api responses

Describe the solution you'd like

  • Return the response back from deserialize
  • Add a test example
  • Also handle the case where the only non-error response is a 3XX and there is no content info for it

Describe alternatives you've considered

Additional context

This issue was created by OpenAPITools/openapi-generator#14009

[BUG] One component $ref referring to another does not work

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request
Description

One component $refing another does not work

openapi-json-schema-generator version
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix

[BUG] v2 spec generation succeeds when it should throw an error

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request
Description

[BUG] v2 spec generation succeeds when it should throw an error
per @Syuparn
and this comment:
OpenAPITools/openapi-generator#13971 (comment)

openapi-json-schema-generator version
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix

Fix: testSpecWithTooLowVersionThrowsException

[REQ] Reduce the docker image size

Is your feature request related to a problem? Please describe.

Reduce the docker image size
All of those files are not needed

Describe the solution you'd like

Describe alternatives you've considered

Additional context

[REQ] Get image publishing in docker hub working

Is your feature request related to a problem? Please describe.

Get image publishing in docker hub working

Describe the solution you'd like

Describe alternatives you've considered

Additional context

[REQ] AWS SigV4 Security Scheme Support

Is your feature request related to a problem? Please describe.

Currently when generating python clients that use AWS's SigV4 authentication, alot of the boilerplate code for signing the authentication token with the signature has to be done outside the client code. This requires us to not only generate the client code, but to then add additional templating and other library code to handle the signing of the authentication request.

securitySchemes:
    sigv4:
      type: 'apiKey'
      name: 'Authorization'
      in: 'header'
      x-amazon-apigateway-authtype: 'awsSigv4'

The securitySchema works very similar to that of the apiKey type, with the addition of a few AWS specific headers and the signing of the token that require the client to have authorized against the AWS service, and have the relevant permissions to call the resource they are attempting to.

Describe the solution you'd like

For the AWS securitySchema to be adopted into the client code generation with built in support. When integrating with API Gateway in AWS, the entire Gateway is typically built using an OpenAPI document. However AWS have several extensions for security, validation, and various other features. It would be useful if going forward we could make contributions to add support for these various features so others in the community could make use of them when generating client code.

Describe alternatives you've considered

We could look at using a custom template to add the signing code as a library in the generated code, but would still require all consumers of the client to do some custom changes when using the API Client to inject the updated signature.

Additional context

I have already done a POC change in a forked repository for supporting this. I just wanted to gather thoughts and ideas if this would be a suitable addition into the project before going through the entire PR and approval process.

[BUG] python generator does not send body for application/x-www-form-urlencoded data

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

The python generator does not send the body in POST requests that require data encoded as application/x-www-form-urlencoded. Also, data serialized for application/x-www-form-urlencoded should not be prefixed with a question mark '?'.

openapi-generator version

6.2.1-SNAPSHOT (built from master)

OpenAPI declaration file content or url

The petstore.yaml specification used for tests in this repo can be used to reproduce this issue.

Generation Details

The normal tests in this repo can reproduce this issue:

./bin/generate-samples.sh ./bin/configs/python*
Steps to reproduce

I found this issue when using the /v5/oauth/token endpoint documented in https://github.com/pinterest/api-description but I'm pretty sure that doing a POST to the petstore /pet/{petId} endpoint using a client generated for python would also reproduce this bug.

Related issues/PRs

I don't understand issue #2411 completely, but it might be fixed when this issue is fixed.

Suggest a fix

I'll submit a pull request with this patch...

$ git diff modules
diff --git a/modules/openapi-generator/src/main/resources/python/api_client.handlebars b/modules/openapi-generator/src/main/resources/python/api_client.handlebars
index bdcd4519ff4..13f4e01ee51 100644
--- a/modules/openapi-generator/src/main/resources/python/api_client.handlebars
+++ b/modules/openapi-generator/src/main/resources/python/api_client.handlebars
@@ -293,7 +293,7 @@ class StyleFormSerializer(ParameterSerializerBase):
         prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator] = None
     ) -> str:
         if prefix_separator_iterator is None:
-            prefix_separator_iterator = PrefixSeparatorIterator('?', '&')
+            prefix_separator_iterator = PrefixSeparatorIterator('', '&')
         return self._ref6570_expansion(
             variable_name=name,
             in_data=in_data,
diff --git a/modules/openapi-generator/src/main/resources/python/rest.handlebars b/modules/openapi-generator/src/main/resources/python/rest.handlebars
index b1811396168..2ca16e1639e 100644
--- a/modules/openapi-generator/src/main/resources/python/rest.handlebars
+++ b/modules/openapi-generator/src/main/resources/python/rest.handlebars
@@ -139,6 +139,7 @@ class RESTClientObject(object):
                 elif headers['Content-Type'] == 'application/x-www-form-urlencoded':  # noqa: E501
                     r = self.pool_manager.request(
                         method, url,
+                        body=body,
                         fields=fields,
                         encode_multipart=False,
                         preload_content=not stream,

Copied from OpenAPITools/openapi-generator#13722

[REQ] Feedback request: BoolClass vs bool, NoneClass vs None, subclassing all validated schemas?

Is your feature request related to a problem? Please describe.

Request for feedback from users of this tool

Describe the solution you'd like

  1. Would people prefer that boolean data stays bool?
  2. Would people prefer that None data stays None?
  3. When do you want classes generated?
    a. dict (json object) based classes
    b. list (json array) based classes. Note: writing these classes will allow for type hints when accessing values using openapi v3.1.0 prefixItems + acessing a value at a specific index
    c. what about composition(oneOf/anyOf/allOf/not) classes?
    d. simple data types with validation str/number/int?
  4. Is the fact that all payloads are instances of their validated schema useful to you?
  5. Would people prefer that class instances always identify their base type in the IDE? I added that here with will be included in the next major release:
my_model = MyModel(some_str='a')
# my_model is type MyModel[frozendict.frozendict] in the vscode IDE
# my_model.some_str is type SomeStr[str] in the vscode IDE
  1. Do you not like the deep nesting of classes in the Schema_ class? I fixed that in this PR.

Describe alternatives you've considered

I could restructure the tool to keep boolean values as bool, None values as None and only generate schema classes for
json object models. I could also make it so that payloads are instances of one class only.

  • json schema validations would still be run
  • but because the payloads do not subclass all vaidated schemas, validation would be run again if checking if a specific part of a payload is valid to a specific schema. Today validation would NOT need to be rerun because validation results are stored in the generated classes.

Inheriting from a single class would allow enums to be used.

Notes on overloading the __new__ constructor to allow more specific instance types

  • mypy throws an error if None is returned from __new__
  • vscode does not understand None returns from __new__ or __call__
  • so if one wanted None or bool returns, I would need to restructure the generated class and (json) Schema_ information
    • validated payloads could be instantiated using CompnentNameSchema_.validate(arg)
      • this can return None/bool without any issue + a ComponentName class that is a TypedDict or subclasses frozendict.
      • this allows developers access to the Schema_ info, which is stored in the CompnentNameSchema_ class
      • the IDE would know the return type by adding method overloads of the validate method
      • this same pattern could be used in other languages too, like Kotlin etc

The proposal would look like this:

class DictNoneOrBoolDict(typing_extensions.TypedDict):
    foo: int
    bar: str

Class DictNoneOrBoolchema_:
    # openapi schema data
    types = {bool, dict}

    # any needed python data
    python_types = typing.Union[bool, None, DictNoneOrBoolDict]

    @typing.overload
    @classmethod
    def valdate(cls, arg: bool) -> bool:
        ...
    @typing.overload
    @classmethod
    def validate(cls, arg: None) -> None:
        ...
    @typing.overload
    @classmethod
    def validate(cls, arg: DictOrBoolDict) -> DictNoneOrBoolDict:
        ...
    @classmethod
    def validate(cls, arg):
        # validation logic invoked here, probably still convert date/datetime/uuiid into str
        # Not sure about keeping int/float as Decimal
        # If they are kept separate, then int literals could be used for type hints, which would be nice
        return arg

Additional context

[REQ] Add response header deserialization

Is your feature request related to a problem? Please describe.

Add response header deserialization

Describe the solution you'd like

Response headers should be accessible and their values should be schema instances

Describe alternatives you've considered

Additional context

[BUG] Unable to use args as schema property because it collides with another method input

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When generating a Python client from specs where a API request body has a field named args defined, the generated model file corresponding to the Request Body object contains the following error: Duplicate parameter "args"

openapi-generator version

6.2.1

OpenAPI declaration file content or url

pythonbug.yaml

openapi: 3.0.2
info:
  title: Bug API
  version: '0.0'
  contact:
    name: Curvegrid
  description: Python Client Bug API.
servers:
  - url: 'http://{hostname}'
    variables:
      hostname:
        default: localhost:8080
        description: Bug Test Server.
tags:
  - name: test
paths:
  /foo:
    post:
      operationId: foo
      summary: FooBaz
      description: FooBar.
      tags:
        - test
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Request'
      responses:
        '200':
          description: OK
components:
  schemas:
    Request:
      title: Request
      type: object
      description: A test request body.
      properties:
        args:
          type: string
      required:
        - args
Generation Details
Steps to reproduce

openapi-generator-cli generate -g python -i pythonbug.yaml -o python_client

Related issues/PRs
Suggest a fix

Add args to reserved words

Original bug from: OpenAPITools/openapi-generator#13954

[REQ] Add support for oauth security schemes

Is your feature request related to a problem? Please describe.

Add support for oauth security schemes

Describe the solution you'd like

Please support as many of these as possible:

  • implicit
  • password
  • clientCredentials
  • authorizationCode

Best candidate libraries look like:

How it needs to work:

  • ensure that the requested scope is in the allowed security scopes
  • client_id and client_secret need to be api configuration constants set by a authorization server key
  • client_id and client_secret are unique to the server and client, so do it by hostname of the server
  • hostname should be extracted from the authorizationUrl + tokenUrl

Describe alternatives you've considered

Additional context

This ticket was created by OpenAPITools/openapi-generator#12166

[BUG] passing in model instance into __new__ raises error

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request

Copied issue from: OpenAPITools/openapi-generator#13997
per @Linux13524
Hi @spacether. I can reproduce the issue with the following spec:

openapi: 3.0.0
info:
  version: 1.0.0
  title: issue 13997 spec
  license:
    name: Apache-2.0
    url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
servers: []
tags: []
paths: {}
components:
  schemas:
    EventRequest:
      type: object
      required:
        - event
      properties:
        event:
          $ref: '#/components/schemas/Event'
    Event:
      type: object
      properties:
        name:
          type: string
        occuredAt:
          type: string
        properties:
          type: object

I generated the client then similar how you did:

docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v6.2.1 generate -i /local/openapi-test.yaml -g python -o /local/python_out/

Running the following does work:

>>> from openapi_client.model.event import Event
>>> from openapi_client.model.event_request import EventRequest
EventRequest(event=Event(name="test", properties={}))

But running this does not:

>>> from openapi_client.model.event import Event
>>> from openapi_client.model.event_request import EventRequest
>>> EventRequest(event=Event(name="test", properties={"name": "test"}))

Resulting in a similar error that @OmarBouslama reported:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/openapi/python_out/openapi_client/model/event_request.py", line 80, in __new__
    return super().__new__(
  File "/home/user/openapi/python_out/openapi_client/schemas.py", line 2439, in __new__
    return super().__new__(cls, *args, **kwargs)
  File "/home/user/openapi/python_out/openapi_client/schemas.py", line 532, in __new__
    return __new_cls._get_new_instance_without_conversion_oapg(
  File "/home/user/openapi/python_out/openapi_client/schemas.py", line 436, in _get_new_instance_without_conversion_oapg
    properties = cls._get_properties_oapg(arg, path_to_item, path_to_schemas)
  File "/home/user/openapi/python_out/openapi_client/schemas.py", line 1707, in _get_properties_oapg
    new_value = property_cls._get_new_instance_without_conversion_oapg(
  File "/home/user/openapi/python_out/openapi_client/schemas.py", line 436, in _get_new_instance_without_conversion_oapg
    properties = cls._get_properties_oapg(arg, path_to_item, path_to_schemas)
  File "/home/user/openapi/python_out/openapi_client/schemas.py", line 1707, in _get_properties_oapg
    new_value = property_cls._get_new_instance_without_conversion_oapg(
  File "/home/user/openapi/python_out/openapi_client/schemas.py", line 436, in _get_new_instance_without_conversion_oapg
    properties = cls._get_properties_oapg(arg, path_to_item, path_to_schemas)
  File "/home/user/openapi/python_out/openapi_client/schemas.py", line 1707, in _get_properties_oapg
    new_value = property_cls._get_new_instance_without_conversion_oapg(
AttributeError: type object 'DynamicSchema' has no attribute '_get_new_instance_without_conversion_oapg'

[BUG] AdditionalProperties referenced when it does not exist, object + composition

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request

AdditionalProperties referenced when it does not exist, schema type is object + composition

Description

AdditionalProperties referenced when it does not exist, schema type is object + composition

openapi-json-schema-generator version

opeanpi-generator latest (should be functionally equivalent to this)

OpenAPI declaration file content or url
components:
  schemas:
    AbstractStepMessage:
      required:
        - description
        - discriminator
        - sequenceNumber
      type: object
      properties:
        discriminator:
          type: string
      description: Abstract Step
      discriminator:
        propertyName: discriminator
      anyOf:
        - $ref: '#/components/schemas/AbstractStepMessage'

And when instantiating the class one gets:

  File "/Users/justinblack/programming/swagger_cpayne/venv/lib/python3.9/site-packages/openapi_client-1.0.0-py3.9.egg/openapi_client/model/abstract_step_message.py", line 26, in <module>
  File "/Users/justinblack/programming/swagger_cpayne/venv/lib/python3.9/site-packages/openapi_client-1.0.0-py3.9.egg/openapi_client/model/abstract_step_message.py", line 114, in AbstractStepMessage
AttributeError: type object 'MetaOapg' has no attribute 'additional_properties'

And the instantiation signature is:

    def __new__(
        cls,
        *args: typing.Union[dict, frozendict.frozendict, ],
        sequenceNumber: typing.Union[MetaOapg.additional_properties, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ],
        description: typing.Union[MetaOapg.additional_properties, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ],
        discriminator: typing.Union[MetaOapg.properties.discriminator, str, ],
        _configuration: typing.Optional[schemas.Configuration] = None,
        **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes],
    ) -> 'AbstractStepMessage':

sequenceNumber + description incorrectly refer to nonexistent additional_properties

Generation Details

python

Steps to reproduce
Related issues/PRs
Suggest a fix

This should have been fixed in: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator/pull/44/files

[REQ] CI reduce the number of running nodes

Is your feature request related to a problem? Please describe.

CI reduce the number of running nodes

  • can node3 be removed?

Describe the solution you'd like

Describe alternatives you've considered

Additional context

[REQ] Add overload type hints for model new

Is your feature request related to a problem? Please describe.

Add overload type hints for model new

Describe the solution you'd like

This will enable running mypy on models because the mixin classes will no longer collide!

Describe alternatives you've considered

Additional context

[BUG] Fix endpoint type hint, skip_deserialization=True, when no bodyParam and isOverload = True

Bug Report Checklist

The type hint is missing for this use case

Add this to endpoint_args.handlebars

{{else}}
    {{#if isOverload}}
        {{#eq skipDeserialization "True"}}
    skip_deserialization: typing_extensions.Literal[True],
        {{/eq}}
    {{/if}}
{{/if}}

I noticed this in #35

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request
Description
openapi-json-schema-generator version
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix

[REQ] Handle v3.1.0 mediaType binary definition

Is your feature request related to a problem? Please describe.

Detect mediatype schema unset and set BinarySchema as the type

Also convert legacy definitions like:

type: string
format: binary

Also there is an empty schema for items use case that means this should store binary data:
As seen in the section on multipart/form-data below, the empty schema for items indicates a media type of application/octet-stream.

requestBody:
  content:
    multipart/form-data:
      schema:
        properties:
          # The property name 'file' will be used for all files.
          file:
            type: array
            items: {}

Into an unset schema, and handle it in the same general way?

Question:
What if content-type is */* and the schema is empty schema?
Everything should be allowed.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

[BUG] Can't use multiple security schemes / disable them

Bug Report Checklist

  • [v] Have you provided a full/minimal spec to reproduce the issue?
  • [v] Have you validated the input using an OpenAPI validator (example)?
  • [v] Have you tested with the latest master to confirm the issue still exists?
  • [v] Have you searched for related issues/PRs?
  • [-] What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request
Description

I initially encountered something very much like this, where when using the main openapi-generator I did not get attributes generated for my response (the attributes are required and with normal names e.g. password). I checked swagger-codegen and it worked fine, and I checked this repo's version and it worked also. I much prefer this version or openapi-generator as they have type hints and client side validation.

When trying to use this version (as the successor to openapi-generator) I encountered a couple of issues. I make use of two security headers ob_user_auth (passed as Authentication) and ob_m2m_auth (passed as User-Authentication). As far as I can tell the code doesn't allow for more than 1.

security_requirement_object = self.api_client.configuration.get_security_requirement_object(
    'paths/' + path + '/get/security',
    _security,
    security_index
)

where this code returns a specific security_requirement_object based on an index and security_index_info defaults to

self.security_index_info: SecurityIndexInfo = security_index_info or {'security': 0}

and even if i manually populated it (couldn't see how to easily) it returns an index and as such returns just the one APIToken possibility.

Furthermore, as opposed to the old version, I can't see how to disable the security headers without resorting to something like this:

security_scheme_info: api_configuration.SecuritySchemeInfo = {
    "ob_user_auth": ApiKeySecurityScheme('', '', in_location='fake'),
    "ob_m2m_auth": ApiKeySecurityScheme('', '', in_location='fake'),
}

used_configuration = api_configuration.ApiConfiguration(
    security_scheme_info=security_scheme_info,
)

since security_scheme_instance.apply_auth can't take a dict and there isn't a check for the headers not being set or any other disable method that I can see. This works because if in_location is not one of the if/elif it knows about it ignores it. Am i missing anything?

when i configure with security_scheme_info: api_configuration.SecuritySchemeInfo = {} i get this (only one header is sent):

send: b'GET /api/v1/basic/1ff033ca-bb4b-4b74-b45e-c34b1b2301ec?account_id=1ece138f-4fb0-4f8e-8256-a7edda655c04 HTTP/1.1\r\nHost: localhost:8004\r\nAccept-Encoding: identity\r\nUser-Agent: OpenAPI-JSON-Schema-Generator/1.0.0/python\r\nUser-Authorization: sampleApiKeyValue\r\nAccept: application/json\r\n\r\n'

In the old repo however if I configure it as follows:

configuration.api_key['ob_m2m_auth'] = 'm2m'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
configuration.api_key_prefix['ob_m2m_auth'] = 'Bearer'

# Configure API key authorization: ob_user_auth
configuration.api_key['ob_user_auth'] = 'user'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
configuration.api_key_prefix['ob_user_auth'] = 'Bearer'

it sends this

send: b'GET /api/v1/basic/1ff033ca-bb4b-4b74-b45e-c34b1b2301ec?account_id=1ece138f-4fb0-4f8e-8256-a7edda655c04 HTTP/1.1\r\nHost: localhost:8004\r\nAccept-Encoding: identity\r\nUser-Agent: OpenAPI-Generator/1.0.0/python\r\nAuthorization: Bearer m2m\r\nUser-Authorization: Bearer user\r\nAccept: application/json\r\n\r\n'

which is valid. And if I comment out those config lines it sends nothing - which is exactly what I need for dev environments.

Since the code changes between the repos are significant and you explicitly changed how you manage the security headers - I'm not sure if it is possible still. It might be easier to backport the fix from the issue i referenced above to the old repo for the meanwhile.

TLDR - i would like either to get the attributes working in the old repo or get the security controls able to be a) disabled on demand and b) send multiple auth headers. Is any of that possible?

Here is the script used to test, i could mock up a server if needed to test.

Thanks!

openapi-json-schema-generator version

Using the docker current version - couldn't easily get the internal version.

OpenAPI declaration file content or url

Gist

Generation Details
docker run --rm -v "${PWD}:/local" openapijsonschematools/openapi-json-schema-generator-cli generate \  
    -i /local/openapi.yaml \
    -g python \
    -o /local/token_client_new_openapi
Steps to reproduce

generate with the above gsit and use the following to send a request.

Related issues/PRs
Suggest a fix

[REQ] Add overload type hints for from_openapi_data_

Is your feature request related to a problem? Please describe.

Add overload type hints for from_openapi_data_oapg

Describe the solution you'd like

Describe alternatives you've considered

Additional context

[REQ] Add a type hint for dict inputs to from_openapi_data_oapg

Is your feature request related to a problem? Please describe.

When required properties have invalid names like from and 1string, they cannot be used as named or positional inputs in __new__
They could however be used as keys in typedict inputs in SomeModel.from_openapi_data_oapg

Describe the solution you'd like

To do this, one would need to add something like:

    @classmethod
    def from_openapi_data_oapg(cls, arg: MetaOapg.properties.__annotations__, _configuration: typing.Optional[Configuration] = None):
        return super().from_openapi_data_oapg(arg, _configuration=_configuration)
  • And make MetaOapg.properties.__annotations__ an instance of a TypedDict
  • Required properties must be in one typeddict
  • Optional properties must be in another
  • Required + Optional must be inherited in the final annotation dict
  • If additionalProperties = false then total should be omitted (which is total=True)
  • otherwise add total=False

This came up in: OpenAPITools/openapi-json-schema-generator#26

Describe alternatives you've considered

Additional context

[REQ] Run static checker on generated python code

Is your feature request related to a problem? Please describe.

More an opportunity than a problem. Static type analysis is getting more popular in python. This complements testing in helping reduce bugs in the generated code. Additionally it will help make sure that the generated code is typed in a way that helps consumers with their own static analysis.

Describe the solution you'd like

Now that the python-experimental branch doesn't' support python 2 it's possible to run mypy (static analysis) on the code as part of tox. This would require a number of fixes/changes to be applied to the generator to get it working

Describe alternatives you've considered

There are a number of other type checkers available for python but mypy seems the most common at this time

[blocked] get boolean schemas working

Boolean schemas only work for additionalProperties due to a bug in swagger parser
I filed a bug with the swagger parser project on it here: swagger-api/swagger-parser#1770

Paths forward:

  1. wait until the bug is fixed
  2. preprocess all schemas in the openapi spec and replace booleans with expanded schemas with the same meaning
    • this is difficult, I do not plan on doing it at this time

[BUG] route with only a slash may not work

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request
Description

A route with only a slash "/" may not work
Reported by Scott Knick in Slack

It was producing an import to a non-existent module, and the import was invalid too (like import ./../something.

openapi-json-schema-generator version
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs

Created from OpenAPITools/openapi-generator#15312

Suggest a fix

[BUG] additionalProperties sometimes breaks

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When using an SchemaObject, that contains the additionalProperties attribute with type: object, I get the error:
AttributeError: type object 'MetaOapg' has no attribute 'additional_properties'.

As I have tested this, I have come to the conclusion that this only occurs, when there are other Schemas with additionalProperties defined.

openapi-generator version

Version 6.3.0 Python

OpenAPI declaration file content or url

This my minimal Example to reproduce the bug

openapi: 3.0.0
info:
  version: 1.0.0
  title: issue 13997 spec
  license:
    name: Apache-2.0
    url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
servers: []
tags: []
paths: {}
components:
  schemas:
    Event:
      type: object
      required:
        - apiVersion
        - modules
      properties:
        apiVersion:
          type: string
        timeout:
          type: integer
          format: int32
          example: 10000
        modules:
          type: object
          additionalProperties:
            type: object
    UploadEvent:
      type: object
      properties:
        uploadId:
          type: string
          example: "6Ms5S3"
        result:
          type: object
          additionalProperties:
            type: array
            items:
              type: object

And for some reason this works (without the second event):

openapi: 3.0.0
info:
  version: 1.0.0
  title: issue 13997 spec
  license:
    name: Apache-2.0
    url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
servers: []
tags: []
paths: {}
components:
  schemas:
    Event:
      type: object
      required:
        - apiVersion
        - modules
      properties:
        apiVersion:
          type: string
        timeout:
          type: integer
          format: int32
          example: 10000
        modules:
          type: object
          additionalProperties:
            type: object
Generation Details

java -jar openapi-generator-cli-6.3.0.jar generate -i additional.yaml -g python

Steps to reproduce

Generate with specified yaml file above and try to import Event like: from openapi_client.model.event import Event

Complete Stacktrace
Traceback (most recent call last):
  File "sample.py", line 2, in <module>
    from devaice_web_api_client.model.event import Event
  File "/home/user/.local/lib/python3.8/site-packages/openapi_client/model/event.py", line 26, in <module>
    class Event(
  File "/home/user/.local/lib/python3.8/site-packages/openapi_client/model/event.py", line 36, in Event
    class MetaOapg:
  File "/home/user/.local/lib/python3.8/site-packages/openapi_client/model/event.py", line 42, in MetaOapg
    class properties:
  File "/home/user/.local/lib/python3.8/site-packages/openapi_client/model/event.py", line 46, in properties
    class modules(
  File "/home/user/.local/lib/python3.8/site-packages/openapi_client/model/event.py", line 65, in modules
    **kwargs: typing.Union[MetaOapg.additional_properties, dict, frozendict.frozendict, ],
AttributeError: type object 'MetaOapg' has no attribute 'additional_properties'

Synonym issue from OpenAPITools/openapi-generator#14078
Thank you @Poolmann

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.