FastAPI client generator

Overview

FastAPI-based API Client Generator

Generate a mypy- and IDE-friendly API client from an OpenAPI spec.

  • Sync and async interfaces are both available
  • Comes with support for the OAuth2.0 password flow
  • Easily extended, with built-in support for request middleware
  • Designed for integration with FastAPI, but should work with most OpenAPI specs
  • Makes use of https://github.com/OpenAPITools/openapi-generator

Look inside example/client to see an example of the generated output!


Warning: This is still in the proof-of-concept phase, and should not yet be considered to have a stable interface.

  • Some OpenAPI features (like discriminator fields) are not yet supported.
  • While the goal is to support any OpenAPI spec, it is most likely to work well with specs generated by FastAPI.

If you try this out, please help me by reporting any issues you notice!

Client library usage

from client.api_client import ApiClient, AsyncApis, SyncApis
from client.models import Pet

client = ApiClient(host="http://localhost")
sync_apis = SyncApis(client)
async_apis = AsyncApis(client)

pet_1 = sync_apis.pet_api.get_pet_by_id(pet_id=1)
assert isinstance(pet_1, Pet)

async def get_pet_2() -> Pet:
    pet_2 = await async_apis.pet_api.get_pet_by_id(pet_id=2)
    assert isinstance(pet_2, Pet)
    return pet_2

The example generated client library is contained in example/client.

Generated clients will have the following dependencies:

  • pydantic for models
  • httpx for networking
  • fastapi for jsonable_encoder and OAuth models (I hope to eventually remove this as a dependency)
  • typing_extensions for Enums via Literal (I eventually hope to replace this with standard enums)

More examples of usage (including auth) are contained in example/usage_example.py.

Generating the client library

Using the generator looks like

./scripts/generate.sh -i <openapi_json> -p <package_name> -o <output_path>
  [-n <import_name>] [--include-auth]
  [--] [*openapi-generator-args]

and will produce a client library at <output_path>/<package_name>.

The OpenAPI json input can be either a URL or a local file path.

For example, running

./scripts/generate.sh \
  -i https://petstore.swagger.io/v2/swagger.json \
  -p client \
  -o generated \
  -n example.client \
  --include-auth

produces the example client (along with the OAuth2.0 password flow client), places it in generated/client, and makes any generated client-referencing imports start with example.client.

(Note: to prevent accidental overwrites, you would need to manually remove generated/client if it already exists.)

With FastAPI

  • To generate a client for a default FastAPI app running on localhost (NOT inside a docker container):

      ./scripts/generate.sh -i http://localhost/openapi.json -p my_client -o generated
    
  • Since the generator runs inside docker, if your server is also running in a docker container on the same machine, you may need to provide a special hostname. Passing the --map-localhost argument will make the script attempt to perform this automatically:

      ./scripts/generate.sh --map-localhost -i http://localhost/openapi.json -p my_client -o generated
      # Transforms the input to http://host.docker.internal/openapi.json 
    

Generation details

  • The only local dependencies for generation are docker and standard command line tools.
  • openapi-generator is used to generate the code from the openapi spec
    • The custom templates are located in openapi-python-templates
  • autoflake, isort, and black are used to format the code after generation

Contributing

There are a variety of make rules for setup/testing; here are some highlights:

  • make develop: Sets up the local development environment.
  • make regenerate: Regenerates the example client from the example's openapi.json and the templates.
    • Note: This will overwrite changes! Make sure you commit (or edit the templates) before running this.
  • make: Checks that isort, black, flake8, mypy, and pytest all pass
  • make testcov: Generates a coverage report for the tests.

Pull requests are welcome and appreciated!

Comments
  • Client dependencies issues

    Client dependencies issues

    Hi, I discovered this today when I was about to try something similar. I've run the project in my machine but I get import errors which I suspect is due to different versions in the dependencies (httpx, fastapi, etc.). I have tried to install using poetry but it refuses to install and also the lock seems to be outdated (I can run poetry lock and then poetry install and it installs everything correctly).

    The error that I get when importing is this:

    ~/.pyenv/versions/3.7.5/envs/fastapi_client/lib/python3.7/site-packages/pydantic/main.cpython-37m-x86_64-linux-gnu.so in pydantic.main.MetaModel.__new__()
    
    ~/.pyenv/versions/3.7.5/envs/fastapi_client/lib/python3.7/site-packages/pydantic/utils.cpython-37m-x86_64-linux-gnu.so in pydantic.utils.resolve_annotations()
    
    ~/.pyenv/versions/3.7.5/lib/python3.7/typing.py in _eval_type(t, globalns, localns)
        261     """
        262     if isinstance(t, ForwardRef):
    --> 263         return t._evaluate(globalns, localns)
        264     if isinstance(t, _GenericAlias):
        265         ev_args = tuple(_eval_type(a, globalns, localns) for a in t.__args__)
    
    ~/.pyenv/versions/3.7.5/lib/python3.7/typing.py in _evaluate(self, globalns, localns)
        465                 localns = globalns
        466             self.__forward_value__ = _type_check(
    --> 467                 eval(self.__forward_code__, globalns, localns),
        468                 "Forward references must evaluate to types.",
        469                 is_argument=self.__forward_is_argument__)
    
    ~/src/fastapi_client/generated/hubble_client/models.py in <module>
    
    TypeError: dict expected at most 1 arguments, got 2
    

    This happens when trying to evaluate this generated pydantic model:

    class ArtifactInDBBase(BaseModel):
        name: "str" = Schema(..., alias="name")  # type: ignore
        type: "str" = Schema(..., alias="type")  # type: ignore
        data_objectkey: "str" = Schema(..., alias="data_objectkey")  # type: ignore
    

    As you can see it has one attribute called type, could this be the cause of the issue?

    UPDATE: I have tried to rename the attribute to type_ but still the same error.

    opened by fj-sanchez 5
  • adding License  notice

    adding License notice

    Hello

    I open this ticket to propose a Pull-request concerning the licenses. We would like to use your project as part of an open-source project and we must comply with license law. There are two aspects the license of fastapi_client code and the license of the generated code.

    1. License of the project For the moment since there is no license the default copy copyright law applies, no one may reproduce, distribute, or create derivative works. source GitHub documentation

    2. License of the generated code Since the project doesn't have any license yet, the default copyrights apply to the template. By consequence the generated code include some copyrighted code. In my understanding nobody can use eventually the generated code.

    For these reasons, could you consider adding :

    • A license in the project
    • A notice about the generated code licence.

    I could take charge of the modification and the Pull-request. Will you accept a pull request to do same as openapi-generator did regarding the license ?

    Openapi-generator is under apache 2.0 license and the project contains the following notice :

    3.4 - License information on Generated Code The OpenAPI 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. source

    Thanks Christophe

    opened by ChristopheLallement 2
  • Generate setup.py or alternatives

    Generate setup.py or alternatives

    We want to try this generator, but in our case generated client should be published to PyPI in one of CI/CD steps. I see that this project in the proof-of-concept stage, so I also can be helpful ✌️

    How can I add setup.py to a generated client?

    opened by b0g3r 2
  • Fails request to OpenAPIV3Parser

    Fails request to OpenAPIV3Parser

    It's probably due to firewall rules which I have no control over...

    sudo ./scripts/generate.sh -i http://localhost:8000/openapi.json -p my_client -o generated
    
    java.net.ConnectException: Connection refused (Connection refused)

    [main] WARN  io.swagger.v3.parser.OpenAPIV3Parser - Exception while reading:
    java.net.ConnectException: Connection refused (Connection refused)
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
            at java.net.Socket.connect(Socket.java:589)
            at java.net.Socket.connect(Socket.java:538)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
            at sun.net.www.http.HttpClient.New(HttpClient.java:308)
            at sun.net.www.http.HttpClient.New(HttpClient.java:326)
            at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
            at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
            at io.swagger.v3.parser.util.RemoteUrl.urlToString(RemoteUrl.java:147)
            at io.swagger.v3.parser.OpenAPIV3Parser.readWithInfo(OpenAPIV3Parser.java:137)
            at io.swagger.v3.parser.OpenAPIV3Parser.readLocation(OpenAPIV3Parser.java:58)
            at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
            at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:405)
            at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:453)
            at org.openapitools.codegen.cmd.Generate.run(Generate.java:407)
            at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
    [main] ERROR io.swagger.v3.parser.util.RemoteUrl - unable to read
    java.net.ConnectException: Connection refused (Connection refused)
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
            at java.net.Socket.connect(Socket.java:589)
            at java.net.Socket.connect(Socket.java:538)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
            at sun.net.www.http.HttpClient.New(HttpClient.java:308)
            at sun.net.www.http.HttpClient.New(HttpClient.java:326)
            at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
            at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
            at io.swagger.v3.parser.util.RemoteUrl.urlToString(RemoteUrl.java:147)
            at io.swagger.v3.parser.OpenAPIV3Parser.readWithInfo(OpenAPIV3Parser.java:137)
            at io.swagger.v3.parser.OpenAPIV3Parser.readLocation(OpenAPIV3Parser.java:58)
            at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
            at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:405)
            at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:453)
            at org.openapitools.codegen.cmd.Generate.run(Generate.java:407)
            at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
    [main] ERROR io.swagger.v3.parser.util.RemoteUrl - unable to read
    java.net.ConnectException: Connection refused (Connection refused)
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
            at java.net.Socket.connect(Socket.java:589)
            at java.net.Socket.connect(Socket.java:538)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
            at sun.net.www.http.HttpClient.New(HttpClient.java:308)
            at sun.net.www.http.HttpClient.New(HttpClient.java:326)
            at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
            at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
            at io.swagger.v3.parser.util.RemoteUrl.urlToString(RemoteUrl.java:147)
            at io.swagger.v3.parser.OpenAPIV3Parser.readWithInfo(OpenAPIV3Parser.java:137)
            at io.swagger.v3.parser.OpenAPIV3Parser.readLocation(OpenAPIV3Parser.java:58)
            at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
            at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:405)
            at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:453)
            at org.openapitools.codegen.cmd.Generate.run(Generate.java:407)
            at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
    [main] ERROR io.swagger.parser.util.RemoteUrl - unable to read
    java.net.ConnectException: Connection refused (Connection refused)
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
            at java.net.Socket.connect(Socket.java:589)
            at java.net.Socket.connect(Socket.java:538)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
            at sun.net.www.http.HttpClient.New(HttpClient.java:308)
            at sun.net.www.http.HttpClient.New(HttpClient.java:326)
            at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
            at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
            at io.swagger.parser.util.RemoteUrl.urlToString(RemoteUrl.java:134)
            at io.swagger.parser.Swagger20Parser.readWithInfo(Swagger20Parser.java:44)
            at io.swagger.parser.SwaggerParser.readWithInfo(SwaggerParser.java:32)
            at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:96)
            at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
            at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:405)
            at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:453)
            at org.openapitools.codegen.cmd.Generate.run(Generate.java:407)
            at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
    [main] ERROR io.swagger.parser.util.RemoteUrl - unable to read
    java.net.ConnectException: Connection refused (Connection refused)
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
            at java.net.Socket.connect(Socket.java:589)
            at java.net.Socket.connect(Socket.java:538)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
            at sun.net.www.http.HttpClient.New(HttpClient.java:308)
            at sun.net.www.http.HttpClient.New(HttpClient.java:326)
            at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
            at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
            at io.swagger.parser.util.RemoteUrl.urlToString(RemoteUrl.java:134)
            at io.swagger.parser.Swagger20Parser.readWithInfo(Swagger20Parser.java:44)
            at io.swagger.parser.SwaggerParser.readWithInfo(SwaggerParser.java:32)
            at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:96)
            at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
            at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:405)
            at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:453)
            at org.openapitools.codegen.cmd.Generate.run(Generate.java:407)
            at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
    [main] ERROR io.swagger.parser.util.RemoteUrl - unable to read
    java.net.ConnectException: Connection refused (Connection refused)
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
            at java.net.Socket.connect(Socket.java:589)
            at java.net.Socket.connect(Socket.java:538)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
            at sun.net.www.http.HttpClient.New(HttpClient.java:308)
            at sun.net.www.http.HttpClient.New(HttpClient.java:326)
            at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
            at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
            at io.swagger.parser.util.RemoteUrl.urlToString(RemoteUrl.java:134)
            at io.swagger.parser.Swagger20Parser.readWithInfo(Swagger20Parser.java:44)
            at io.swagger.parser.SwaggerParser.readWithInfo(SwaggerParser.java:42)
            at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:96)
            at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
            at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:405)
            at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:453)
            at org.openapitools.codegen.cmd.Generate.run(Generate.java:407)
            at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
    [main] ERROR io.swagger.parser.util.RemoteUrl - unable to read
    java.net.ConnectException: Connection refused (Connection refused)
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
            at java.net.Socket.connect(Socket.java:589)
            at java.net.Socket.connect(Socket.java:538)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
            at sun.net.www.http.HttpClient.New(HttpClient.java:308)
            at sun.net.www.http.HttpClient.New(HttpClient.java:326)
            at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
            at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
            at io.swagger.parser.util.RemoteUrl.urlToString(RemoteUrl.java:134)
            at io.swagger.parser.Swagger20Parser.readWithInfo(Swagger20Parser.java:44)
            at io.swagger.parser.SwaggerParser.readWithInfo(SwaggerParser.java:42)
            at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:96)
            at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
            at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:405)
            at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:453)
            at org.openapitools.codegen.cmd.Generate.run(Generate.java:407)
            at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
    [main] ERROR io.swagger.parser.util.RemoteUrl - unable to read
    java.net.ConnectException: Connection refused (Connection refused)
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
            at java.net.Socket.connect(Socket.java:589)
            at java.net.Socket.connect(Socket.java:538)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
            at sun.net.www.http.HttpClient.New(HttpClient.java:308)
            at sun.net.www.http.HttpClient.New(HttpClient.java:326)
            at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
            at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
            at io.swagger.parser.util.RemoteUrl.urlToString(RemoteUrl.java:134)
            at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:193)
            at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:123)
            at io.swagger.parser.SwaggerCompatConverter.readWithInfo(SwaggerCompatConverter.java:94)
            at io.swagger.parser.SwaggerParser.readWithInfo(SwaggerParser.java:42)
            at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:96)
            at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
            at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:405)
            at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:453)
            at org.openapitools.codegen.cmd.Generate.run(Generate.java:407)
            at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
    [main] ERROR io.swagger.parser.util.RemoteUrl - unable to read
    java.net.ConnectException: Connection refused (Connection refused)
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
            at java.net.Socket.connect(Socket.java:589)
            at java.net.Socket.connect(Socket.java:538)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
            at sun.net.www.http.HttpClient.New(HttpClient.java:308)
            at sun.net.www.http.HttpClient.New(HttpClient.java:326)
            at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
            at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
            at io.swagger.parser.util.RemoteUrl.urlToString(RemoteUrl.java:134)
            at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:193)
            at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:123)
            at io.swagger.parser.SwaggerCompatConverter.readWithInfo(SwaggerCompatConverter.java:94)
            at io.swagger.parser.SwaggerParser.readWithInfo(SwaggerParser.java:42)
            at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:96)
            at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
            at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:405)
            at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:453)
            at org.openapitools.codegen.cmd.Generate.run(Generate.java:407)
            at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
    [main] ERROR i.s.parser.SwaggerCompatConverter - failed to read resource listing
    java.net.ConnectException: Connection refused (Connection refused)
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
            at java.net.Socket.connect(Socket.java:589)
            at java.net.Socket.connect(Socket.java:538)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
            at sun.net.www.http.HttpClient.New(HttpClient.java:308)
            at sun.net.www.http.HttpClient.New(HttpClient.java:326)
            at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
            at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
            at io.swagger.parser.util.RemoteUrl.urlToString(RemoteUrl.java:134)
            at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:193)
            at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:123)
            at io.swagger.parser.SwaggerCompatConverter.readWithInfo(SwaggerCompatConverter.java:94)
            at io.swagger.parser.SwaggerParser.readWithInfo(SwaggerParser.java:42)
            at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:96)
            at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
            at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:405)
            at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:453)
            at org.openapitools.codegen.cmd.Generate.run(Generate.java:407)
            at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
    [main] ERROR i.s.parser.SwaggerCompatConverter - failed to read resource listing
    java.net.ConnectException: Connection refused (Connection refused)
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
            at java.net.Socket.connect(Socket.java:589)
            at java.net.Socket.connect(Socket.java:538)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
            at sun.net.www.http.HttpClient.New(HttpClient.java:308)
            at sun.net.www.http.HttpClient.New(HttpClient.java:326)
            at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
            at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
            at io.swagger.parser.util.RemoteUrl.urlToString(RemoteUrl.java:134)
            at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:193)
            at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:123)
            at io.swagger.parser.SwaggerCompatConverter.readWithInfo(SwaggerCompatConverter.java:94)
            at io.swagger.parser.SwaggerParser.readWithInfo(SwaggerParser.java:42)
            at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:96)
            at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
            at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:405)
            at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:453)
            at org.openapitools.codegen.cmd.Generate.run(Generate.java:407)
            at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
    Exception in thread "main" java.lang.NullPointerException
            at java.util.HashSet.<init>(HashSet.java:118)
            at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:408)
            at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:453)
            at org.openapitools.codegen.cmd.Generate.run(Generate.java:407)
            at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
    

    Is it possible to remove the network request?

    opened by okomarov 1
  • Generator seems to fail on Enum classes

    Generator seems to fail on Enum classes

    produces this in the temporary directory, it has nothing in the class

    class FormatterEnum(BaseModel):
    

    This is the server-side class used in API endpoint

    class FormatterEnum(str, Enum):
        JSON = "JSON"
        TXT = "TXT"
        TSV = "TSV"
        TXT_PAGES = "TXT_PAGES"
    
    async def predict(
        document: UploadFile = File(
            ...,
        ),
        format: FormatterEnum = FormatterEnum.TXT_PAGES,
    ) -> dict:
    
    opened by ghandic 1
  • isort error due to isort v5

    isort error due to isort v5

    I am getting

    isort: error: argument -a/--add-import: expected one argument
    

    This is apparently due to isort v5 being installed in the Dockerfile. If I edit the pip command in the Dockerfile to pin isort==4.3.21 it works again.

    Sorry I don't have time right now to analyze it in more depth, but I wanted to at least report it.

    opened by maresb 1
  • Update packages and fix models refs

    Update packages and fix models refs

    A few changes have been included here:

    • Updated httpx, fastapi and pydantic to latest versions.
    • Updated deprecated methods/classes from httpx and pydantic.
    • Added automatic update of forward references for pydantic models.
    • Docker images will be run as current user instead of root.
    opened by fj-sanchez 1
  • Map {}, None or Any to Any instead of object

    Map {}, None or Any to Any instead of object

    APIs with a response schema of {} were translated to returning object, which causes a validation fail.

    Mapping to Any fixes this, I'm not sure this is the best solution.

    opened by Toumetis 1
  • add apache license

    add apache license

    Hi Following this issue, this pull-request proposes to put this project under apache license of course the choice of this license is only a proposal, if you want another one just tell me. On the other hand, I ask you to agree to add a license to your project because the lack of license prevents us from being able to use yours. Thanks.

    opened by ChristopheLallement 0
  • Add possibility to run the code generation on Windows

    Add possibility to run the code generation on Windows

    Hi,

    I was able to run the code generation on my Windows machine. Please review the changes I was needed to do for making it work on Windows. Overall the changes are not disruptive, so you might consider merging it to the master branch.

    Thanks. Kostya

    opened by kdeyev 0
  • Fix for enum.Enum subclasses

    Fix for enum.Enum subclasses

    Hi, I faced the same issue reported in this issue. The solution uses another template branch for enum types. The schema definition for the model looks like:

        Method:
          title: Method
          enum:
          - One
          - Two
          - Three
          type: string
          description: An enumeration.
    

    And the expectation for the generated pydantic model:

    class Method(str, Enum):
        ONE = "One"
        TWO = "Two"
        THREE = "Three"
    

    Please, take a look at the changes I made.

    Thanks. Kostya.

    opened by kdeyev 0
  • java.lang.NullPointerException when encountering nullable enums

    java.lang.NullPointerException when encountering nullable enums

    Description

    Cannot generate models with nullable enums. The normal openapi-generator tool with the default python generator does not encounter this error (tried with both v4.1.2 and v.5.2.1).

    Minimal Reproducible Example

    openapi: 3.0.0
    info:
      description: TestAPI
      version: "0.0.1"
      title: MRE API Definition
    paths:
      /inventory:
        get:
          responses:
            '200':
              description: result
              content:
                application/json:
                  schema:
                    type: object
                    properties:
                      value:
                        type: string
                        nullable: true
                        enum:
                        - value1
                        - value2
                        - null
    

    Traceback

    Storing intermediate outputs in /Users/user/repos/personal/fastapi_client/tmp.TvRoVuZrA; it will be removed if generation is successful
    [main] INFO  o.o.codegen.DefaultGenerator - Generating with dryRun=false
    [main] INFO  o.o.codegen.DefaultGenerator - OpenAPI Generator: python (client)
    [main] INFO  o.o.codegen.DefaultGenerator - Generator 'python' is considered experimental.
    [main] INFO  o.o.c.l.AbstractPythonCodegen - Environment variable PYTHON_POST_PROCESS_FILE not defined so the Python code may not be properly formatted. To define it, try 'export PYTHON_POST_PROCESS_FILE="/usr/local/bin/yapf -i"' (Linux/Mac)
    [main] INFO  o.o.c.l.AbstractPythonCodegen - NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).
    [main] INFO  o.o.c.l.PythonLegacyClientCodegen - Environment variable PYTHON_POST_PROCESS_FILE not defined so the Python code may not be properly formatted. To define it, try 'export PYTHON_POST_PROCESS_FILE="/usr/local/bin/yapf -i"' (Linux/Mac)
    [main] INFO  o.o.c.l.PythonLegacyClientCodegen - NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).
    [main] INFO  o.o.c.languages.PythonClientCodegen - generateAliasAsModel is hard coded to true in this generator. Alias models will only be generated if they contain validations or enums
    [main] INFO  o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
    [main] INFO  o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
    Exception in thread "main" java.lang.RuntimeException: Could not generate model 'inline_response_200'
    	at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:544)
    	at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:899)
    	at org.openapitools.codegen.cmd.Generate.execute(Generate.java:441)
    	at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
    	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
    Caused by: java.lang.NullPointerException: Null context for variable 'this' on line 25
    	at com.samskivert.mustache.Template.getValueIn(Template.java:288)
    	at com.samskivert.mustache.Template.getValue(Template.java:224)
    	at com.samskivert.mustache.Template.getValueOrDefault(Template.java:279)
    	at com.samskivert.mustache.Mustache$VariableSegment.execute(Mustache.java:802)
    	at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
    	at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:866)
    	at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
    	at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:881)
    	at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
    	at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:870)
    	at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
    	at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:866)
    	at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
    	at com.samskivert.mustache.Mustache$InvertedSegment.execute(Mustache.java:906)
    	at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
    	at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:881)
    	at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
    	at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:866)
    	at com.samskivert.mustache.Template.executeSegs(Template.java:157)
    	at com.samskivert.mustache.Template.execute(Template.java:134)
    	at com.samskivert.mustache.Template.execute(Template.java:125)
    	at org.openapitools.codegen.templating.MustacheEngineAdapter.compileTemplate(MustacheEngineAdapter.java:65)
    	at org.openapitools.codegen.TemplateManager.write(TemplateManager.java:163)
    	at org.openapitools.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:1041)
    	at org.openapitools.codegen.DefaultGenerator.generateModel(DefaultGenerator.java:382)
    	at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:535)
    	... 4 more
    
    opened by relsunkaev 0
  • Generate step hangs

    Generate step hangs

    After running the command on macos

    ./scripts/generate.sh \
      -i https://raw.githubusercontent.com/alpacahq/bkdocs/master/assets/openapi.yaml \
      -p client \
      -o generated \
      -n api.services.alpaca.broker.client
    

    I get the output

    Storing intermediate outputs in /Users/brapaport/udon/fastapi_client/tmp.BUD4aF2bG; it will be removed if generation is successful
    WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
    

    But it appears to hang forever.

    opened by br-allstreet 2
  • Missing status code 204 support.

    Missing status code 204 support.

    There is no 204 status code support in api_client.py, which will cause issue when status code is 204 like set_assignee api etc.

    Current Code

    async def send(self, request: Request, type_: Type[T]) -> T:
      response = await self.middleware(request, self.send_inner)
      if response.status_code in [200, 201]:
          try:
              return parse_obj_as(type_, response.json())
          except ValidationError as e:
              raise ResponseHandlingException(e)
      raise UnexpectedResponse.for_response(response)
    

    Issue:

    Exception raised when 204 returned.

    Unexpected Response: 204 (Unrecognized Status Code)

    Current resolution:

    We manually added 204 support as below to avoid exception.

    if response.status_code == 204:
        return response
    
    opened by myheartsgoon 0
  •  forward_refs updates not running in all classes that need it

    forward_refs updates not running in all classes that need it

    When running a simple example client I get the following error:

    pydantic.errors.ConfigError: field "status" not yet prepared so type is still a ForwardRef, 
      you might need to call Metadata.update_forward_refs().
    

    It seems that the initialization code in client/__init__.py is not finding all the classes that need the fwd_refs to be updated. My solution was to run update_forward_refs in all classes (openapi-python-templates/__init__package.mustache)

    for model in inspect.getmembers(models, inspect.isclass):
        if model[1].__module__ == "client.models":
            model_class = model[1]
            if isinstance(model_class, BaseModel) or hasattr(model_class, "update_forward_refs"):
                model_class.update_forward_refs()
    
    opened by agostof 4
  • Generator failing on class with Custom Root Type

    Generator failing on class with Custom Root Type

    The models in the temporary work directory for several classes are empty and causes the generator to stop. The models in question are looking like:

    class TraitNewRequest(BaseModel):
    

    What I see in common for the models affected is that the server-side definition has a __root__ attribute (pydantic custom root type). They are defined as follows on the server-side:

    class TraitNewRequest(BaseModel):
        __root__: TraitBaseClass
    
    
    opened by agostof 0
Owner
David Montague
David Montague
:rocket: CLI tool for FastAPI. Generating new FastAPI projects & boilerplates made easy.

Project generator and manager for FastAPI. Source Code: View it on Github Features ?? Creates customizable project boilerplate. Creates customizable a

Yagiz Degirmenci 1k Jan 2, 2023
Simple FastAPI Example : Blog API using FastAPI : Beginner Friendly

fastapi_blog FastAPI : Simple Blog API with CRUD operation Steps to run the project: git clone https://github.com/mrAvi07/fastapi_blog.git cd fastapi-

Avinash Alanjkar 1 Oct 8, 2022
Пример использования GraphQL Ariadne с FastAPI и сравнение его с GraphQL Graphene FastAPI

FastAPI Ariadne Example Пример использования GraphQL Ariadne с FastAPI и сравнение его с GraphQL Graphene FastAPI - GitHub ###Запуск на локальном окру

ZeBrains Team 9 Nov 10, 2022
Sample-fastapi - A sample app using Fastapi that you can deploy on App Platform

Getting Started We provide a sample app using Fastapi that you can deploy on App

Erhan BÜTE 2 Jan 17, 2022
Flask-vs-FastAPI - Understanding Flask vs FastAPI Web Framework. A comparison of two different RestAPI frameworks.

Flask-vs-FastAPI Understanding Flask vs FastAPI Web Framework. A comparison of two different RestAPI frameworks. IntroductionIn Flask is a popular mic

Mithlesh Navlakhe 1 Jan 1, 2022
FastAPI Server Session is a dependency-based extension for FastAPI that adds support for server-sided session management

FastAPI Server-sided Session FastAPI Server Session is a dependency-based extension for FastAPI that adds support for server-sided session management.

DevGuyAhnaf 5 Dec 23, 2022
fastapi-admin2 is an upgraded fastapi-admin, that supports ORM dialects, true Dependency Injection and extendability

FastAPI2 Admin Introduction fastapi-admin2 is an upgraded fastapi-admin, that supports ORM dialects, true Dependency Injection and extendability. Now

Glib 14 Dec 5, 2022
Code Specialist 27 Oct 16, 2022
Fastapi-ml-template - Fastapi ml template with python

FastAPI ML Template Run Web API Local $ sh run.sh # poetry run uvicorn app.mai

Yuki Okuda 29 Nov 20, 2022
FastAPI-Amis-Admin is a high-performance, efficient and easily extensible FastAPI admin framework. Inspired by django-admin, and has as many powerful functions as django-admin.

简体中文 | English 项目介绍 FastAPI-Amis-Admin fastapi-amis-admin是一个拥有高性能,高效率,易拓展的fastapi管理后台框架. 启发自Django-Admin,并且拥有不逊色于Django-Admin的强大功能. 源码 · 在线演示 · 文档 · 文

AmisAdmin 318 Dec 31, 2022
This code generator creates FastAPI app from an openapi file.

fastapi-code-generator This code generator creates FastAPI app from an openapi file. This project is an experimental phase. fastapi-code-generator use

Koudai Aono 632 Jan 5, 2023
Full stack, modern web application generator. Using FastAPI, PostgreSQL as database, Docker, automatic HTTPS and more.

Full Stack FastAPI and PostgreSQL - Base Project Generator Generate a backend and frontend stack using Python, including interactive API documentation

Sebastián Ramírez 10.8k Jan 8, 2023
A dynamic FastAPI router that automatically creates CRUD routes for your models

⚡ Create CRUD routes with lighting speed ⚡ A dynamic FastAPI router that automatically creates CRUD routes for your models

Adam Watkins 950 Jan 8, 2023
Adds simple SQLAlchemy support to FastAPI

FastAPI-SQLAlchemy FastAPI-SQLAlchemy provides a simple integration between FastAPI and SQLAlchemy in your application. It gives access to useful help

Michael Freeborn 465 Jan 7, 2023
Opinionated set of utilities on top of FastAPI

FastAPI Contrib Opinionated set of utilities on top of FastAPI Free software: MIT license Documentation: https://fastapi-contrib.readthedocs.io. Featu

identix.one 543 Jan 5, 2023
Reusable utilities for FastAPI

Reusable utilities for FastAPI Documentation: https://fastapi-utils.davidmontague.xyz Source Code: https://github.com/dmontagu/fastapi-utils FastAPI i

David Montague 1.3k Jan 4, 2023
FastAPI framework plugins

Plugins for FastAPI framework, high performance, easy to learn, fast to code, ready for production fastapi-plugins FastAPI framework plugins Cache Mem

RES 239 Dec 28, 2022
Prometheus exporter for Starlette and FastAPI

starlette_exporter Prometheus exporter for Starlette and FastAPI. The middleware collects basic metrics: Counter: starlette_requests_total Histogram:

Steve Hillier 225 Jan 5, 2023
🚀 Cookiecutter Template for FastAPI + React Projects. Using PostgreSQL, SQLAlchemy, and Docker

FastAPI + React · A cookiecutter template for bootstrapping a FastAPI and React project using a modern stack. Features FastAPI (Python 3.8) JWT authen

Gabriel Abud 1.4k Jan 2, 2023