Skip to content

Commit

Permalink
feat(python): fastapi generator with pydantic v2 (#5087)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi authored Nov 4, 2024
1 parent 458c5bf commit 0eeebdb
Show file tree
Hide file tree
Showing 909 changed files with 17,075 additions and 388 deletions.
20 changes: 0 additions & 20 deletions fern.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2656,26 +2656,6 @@
"type": "null"
}
]
},
"transport": {
"oneOf": [
{
"$ref": "#/definitions/service.ServiceTransport"
},
{
"type": "null"
}
]
},
"source": {
"oneOf": [
{
"$ref": "#/definitions/source.SourceSchema"
},
{
"type": "null"
}
]
}
},
"required": [
Expand Down
162 changes: 80 additions & 82 deletions fern/apis/fern-definition/definition/service.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
imports:
imports:
commons: commons.yml
types: types.yml
examples: examples.yml
pagination: pagination.yml
source: source.yml
variables: variables.yml

types:
HttpServiceSchema:
extends:
types:
HttpServiceSchema:
extends:
- commons.DeclarationWithoutDocsSchema
- commons.WithDisplayName
properties:
properties:
auth: boolean
url: optional<string>
base-path: string
path-parameters: optional<map<string, string>>
idempotent: optional<boolean>
headers: optional<map<string, types.TypeReferenceSchema>>
transport: optional<ServiceTransport>
transport: optional<ServiceTransport>
source: optional<source.SourceSchema>
endpoints: map<string, HttpEndpointSchema>

ServiceTransport:
properties:
grpc: optional<GrpcTransport>

GrpcTransport:
properties:
service-name:
ServiceTransport:
properties:
grpc: optional<GrpcTransport>
GrpcTransport:
properties:
service-name:
type: string
docs: "The name of the gRPC service."

HttpEndpointSchema:
extends:
HttpEndpointSchema:
extends:
- commons.WithDisplayName
- commons.DeclarationSchema
properties:
properties:
method: optional<HttpMethodSchema>
base-path: optional<string>
path: string
Expand All @@ -51,144 +51,142 @@ types:
errors: optional<ResponseErrorsSchema>
examples: optional<list<examples.ExampleEndpointCallSchema>>
pagination: optional<Pagination>
transport: optional<ServiceTransport>
source: optional<source.SourceSchema>

HttpMethodSchema:
enum:

HttpMethodSchema:
enum:
- GET
- POST
- PUT
- PATCH
- DELETE

HttpRequest:
HttpRequest:
discriminated: false
union:
union:
- string
- HttpRequestSchema

HttpRequestSchema:
extends:
extends:
- commons.WithName
- commons.WithDocsSchema
properties:
properties:
content-type: optional<string>
query-parameters: optional<map<string, HttpQueryParameterSchema>>
headers: optional<map<string, HttpHeaderSchema>>
body: optional<HttpRequestBodySchema>

TypeReferenceDeclarationWithEnvOverride:
discriminated: false
union:
union:
- string
- TypeReferenceDeclarationWithEnvOverrideSchema

TypeReferenceDeclarationWithEnvOverrideSchema:
TypeReferenceDeclarationWithEnvOverrideSchema:
extends: types.TypeReferenceDeclarationWithName
properties:
properties:
env: optional<string>

HttpHeaderSchema: TypeReferenceDeclarationWithEnvOverride

HttpRequestBodySchema:
HttpRequestBodySchema:
discriminated: false
union:
union:
- string
- HttpReferencedRequestBodySchema
- HttpInlineRequestBodySchema

HttpReferencedRequestBodySchema:
extends:
HttpReferencedRequestBodySchema:
extends:
- commons.WithDocsSchema
properties:
type: string

HttpInlineRequestBodySchema:
properties:
HttpInlineRequestBodySchema:
properties:
extends: optional<types.ObjectExtendsSchema>
extra-properties: optional<boolean>
properties: optional<map<string, HttpInlineRequestBodyPropertySchema>>

HttpInlineRequestBodyPropertySchema:
HttpInlineRequestBodyPropertySchema:
discriminated: false
union:
union:
- string
- TypeReferenceDeclarationWithContentTypeSchema

TypeReferenceDeclarationWithContentTypeSchema:
TypeReferenceDeclarationWithContentTypeSchema:
extends: types.TypeReferenceDeclarationWithName
properties:
properties:
content-type: optional<string>

HttpQueryParameterSchema:
HttpQueryParameterSchema:
discriminated: false
union:
union:
- string
- QueryParameterTypeReferenceDetailed

QueryParameterTypeReferenceDetailed:
extends:
QueryParameterTypeReferenceDetailed:
extends:
- types.TypeReferenceDeclarationWithName
properties:
properties:
allow-multiple: optional<boolean>

HttpResponseSchema:
HttpResponseSchema:
discriminated: false
union:
union:
- string
- HttpResponseSchemaDetailed

HttpResponseSchemaDetailed:
extends:
HttpResponseSchemaDetailed:
extends:
- commons.WithDocsSchema
properties:
properties:
type: string
property: optional<string>
status-code: optional<integer>

HttpResponseStreamSchema:
HttpResponseStreamSchema:
discriminated: false
union:
union:
- string
- HttpResponseStreamSchemaDetailed

HttpResponseStreamSchemaDetailed:
extends:
HttpResponseStreamSchemaDetailed:
extends:
- commons.WithDocsSchema
properties:
properties:
type: string
format: optional<StreamFormat>
terminator: optional<string>

StreamFormat:
enum:
StreamFormat:
enum:
- sse
- json

HttpPathParameterSchema:
HttpPathParameterSchema:
discriminated: false
union:
union:
- types.TypeReferenceSchema
- variables.VariableReferenceSchema

Pagination:
Pagination:
discriminated: false
union:
union:
- pagination.PaginationSchema
- boolean

ResponseErrorsSchema:
ResponseErrorsSchema:
type: list<ResponseError>

ResponseError:
ResponseError:
discriminated: false
union:
union:
- string
- ResponseErrorWithDocsSchema

ResponseErrorWithDocsSchema:
extends:
ResponseErrorWithDocsSchema:
extends:
- commons.WithDocsSchema
properties:
error: string
properties:
error: string
10 changes: 3 additions & 7 deletions fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -448,13 +448,6 @@ navigation:
- page: SDK Snippets
icon: fa-regular fa-message-code
path: ./pages/fern-docs/config/sdk-snippets.mdx
- section: API Playground
path: ./pages/fern-docs/content/api-playground.mdx
icon: fa-regular fa-square-terminal
contents:
- page: Advanced Configuration
icon: fa-regular fa-wrench
path: ./pages/fern-docs/content/customize-api-playground.mdx
- page: Endpoint Errors
icon: fa-regular fa-exclamation-triangle
path: ./pages/fern-docs/config/endpoint-errors.mdx
Expand All @@ -464,6 +457,9 @@ navigation:
- page: Write Markdown in API Reference
icon: fa-regular fa-pencil
path: ./pages/fern-docs/content/api-ref-content.mdx
- page: Customize API Playground
icon: fa-regular fa-square-terminal
path: ./pages/fern-docs/content/customize-api-playground.mdx

- section: Integrations
slug: integrations
Expand Down
Loading

0 comments on commit 0eeebdb

Please sign in to comment.