Skip to content

Full reproducible example & importing models #14

@adriangb

Description

@adriangb

Hi,

I'm trying to get started with this package, but I am having some issues with my OpenAPI schema (generated from FastAPI). I tried pulling from the example in example but since there is no input schema given it's a bit hard. Before I start asking a bunch of easily resolvable questions, would it be possible to add the input schema to the example folder (and maybe a README.md with all of the steps needed, including dependency installation) so that I can compare to what I am doing and figure out the problems myself?

I do want to ask one specific question: my Pydantic models use regex validated fields which get exported into the schema but do not appear in the fastapi_client generated models.py.
Example original model:

class Scan(BaseModel):
    position: str = Field(regex=...)

Generated model:

class Scan(BaseModel):
    position: "str" = Field(..., alias="position")

Since I have the originals, is there any way to "add" the original models.py to the compilation namespace (not sure how to word this) so that it can be used in lieu of models generated from the schema? This would also help preserve any use of @validator or other advanced Pydantic features.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions