Skip to content

Commit

Permalink
chore: turn on noOptionalProperties and useBrandedStringAliases for f…
Browse files Browse the repository at this point in the history
…dr (#1532)
  • Loading branch information
abvthecity authored Sep 24, 2024
1 parent fbbc6a0 commit ad0a7a0
Show file tree
Hide file tree
Showing 1,300 changed files with 5,674 additions and 6,075 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ jobs:
- name: Codegen
run: |
pnpm fdr:generate
pnpm navigation:generate
pnpm turbo --filter=@fern-platform/fdr codegen
- name: Ensure no changes to git-tracked files
Expand Down
10 changes: 5 additions & 5 deletions fern/apis/fdr/definition/algolia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ types:
AlgoliaEndpointRecordV4:
extends: AlgoliaPageRecordV4
properties:
method: apiReadV1Endpoint.HttpMethod
method: commons.HttpMethod
endpointPath: list<apiReadV1Endpoint.EndpointPathPart>
isResponseStream: optional<boolean>

AlgoliaEndpointRecordV3:
extends: AlgoliaPageRecordV3
properties:
method: apiReadV1Endpoint.HttpMethod
method: commons.HttpMethod
endpointPath: list<apiReadV1Endpoint.EndpointPathPart>
isResponseStream: optional<boolean>

Expand All @@ -89,13 +89,13 @@ types:
AlgoliaWebhookRecordV4:
extends: AlgoliaPageRecordV4
properties:
method: apiReadV1Endpoint.HttpMethod
method: commons.HttpMethod
endpointPath: list<apiReadV1Endpoint.EndpointPathPart>

AlgoliaWebhookRecordV3:
extends: AlgoliaPageRecordV3
properties:
method: apiReadV1Endpoint.HttpMethod
method: commons.HttpMethod
endpointPath: list<apiReadV1Endpoint.EndpointPathPart>

AlgoliaMarkdownSectionRecordV1:
Expand Down Expand Up @@ -203,7 +203,7 @@ types:
properties:
name: optional<string>
description: optional<string>
method: apiReadV1Endpoint.HttpMethod
method: commons.HttpMethod
path: AlgoliaRecordEndpointPath

AlgoliaRecordVersion:
Expand Down
46 changes: 46 additions & 0 deletions fern/apis/fdr/definition/api/v1/commons.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

imports:
rootCommons: ../../commons.yml

types:
TypeId: string

SubpackageId: string

WebSocketMessageId: string

PathParameterKey: string

PropertyKey: string

WebSocketMessageOrigin:
enum:
- client
- server

WebhookHttpMethod:
enum:
- GET
- POST

WithDescription:
properties:
description: optional<string>

WithAvailability:
properties:
availability: optional<Availability>

Availability:
enum:
- GenerallyAvailable
- Deprecated
- Beta

JqString: string

Environment:
properties:
id: rootCommons.EnvironmentId
baseUrl: string
18 changes: 9 additions & 9 deletions fern/apis/fdr/definition/api/v1/db/__package__.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ imports:
rootCommons: ../../../commons.yml
readRoot: ../read/__package__.yml
readType: ../read/type.yml
readCommons: ../read/commons.yml
commons: ../commons.yml
readWebhook: ../read/webhook.yml
readWebsocket: ../read/websocket.yml
readEndpoint: ../read/endpoint.yml
Expand All @@ -15,8 +15,8 @@ types:
properties:
id: rootCommons.ApiDefinitionId
rootPackage: DbApiDefinitionPackage
types: map<readType.TypeId, readType.TypeDefinition>
subpackages: map<readRoot.SubpackageId, DbApiDefinitionSubpackage>
types: map<commons.TypeId, readType.TypeDefinition>
subpackages: map<commons.SubpackageId, DbApiDefinitionSubpackage>
auth: optional<readRoot.ApiAuth>
hasMultipleBaseUrls:
type: boolean
Expand All @@ -34,21 +34,21 @@ types:
endpoints: list<endpoint.DbEndpointDefinition>
websockets: optional<list<readWebsocket.WebSocketChannel>>
webhooks: optional<list<readWebhook.WebhookDefinition>>
types: list<readType.TypeId>
subpackages: list<readRoot.SubpackageId>
types: list<commons.TypeId>
subpackages: list<commons.SubpackageId>
pointsTo:
docs: |
if present, this package should be replaced with the provided subpackage
in the docs navigation.
type: optional<readRoot.SubpackageId>
type: optional<commons.SubpackageId>

DbApiDefinitionSubpackage:
extends:
- readCommons.WithDescription
- commons.WithDescription
- DbApiDefinitionPackage
properties:
parent: optional<readRoot.SubpackageId>
subpackageId: readRoot.SubpackageId
parent: optional<commons.SubpackageId>
subpackageId: commons.SubpackageId
name: string
urlSlug: string
displayName: optional<string>
17 changes: 9 additions & 8 deletions fern/apis/fdr/definition/api/v1/db/endpoint.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

imports:
readCommons: ../read/commons.yml
rootCommons: ../../../commons.yml
commons: ../commons.yml
readEndpoint: ../read/endpoint.yml

types:
DbEndpointDefinition:
extends: readCommons.WithDescription
extends: commons.WithDescription
properties:
authed: optional<boolean>
availability: optional<readCommons.Availability>
defaultEnvironment: optional<readEndpoint.EnvironmentId>
environments: optional<list<readEndpoint.Environment>>
method: readEndpoint.HttpMethod
id: readEndpoint.EndpointId
availability: optional<commons.Availability>
defaultEnvironment: optional<rootCommons.EnvironmentId>
environments: optional<list<commons.Environment>>
method: rootCommons.HttpMethod
id: rootCommons.EndpointId
originalEndpointId: optional<string>
urlSlug: string
migratedFromUrlSlugs: optional<list<string>>
Expand All @@ -29,7 +30,7 @@ types:
snippetTemplates: optional<readEndpoint.EndpointSnippetTemplates>

DbHttpRequest:
extends: readCommons.WithDescription
extends: commons.WithDescription
properties:
contentType: optional<string>
type: readEndpoint.HttpRequestBodyShape
28 changes: 13 additions & 15 deletions fern/apis/fdr/definition/api/v1/read/__package__.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ imports:
endpoint: endpoint.yml
type: type.yml
rootCommons: ../../../commons.yml
commons: commons.yml
commons: ../commons.yml
webhook: webhook.yml
websocket: websocket.yml

Expand All @@ -28,8 +28,8 @@ types:
properties:
id: rootCommons.ApiDefinitionId
rootPackage: ApiDefinitionPackage
types: map<type.TypeId, type.TypeDefinition>
subpackages: map<SubpackageId, ApiDefinitionSubpackage>
types: map<commons.TypeId, type.TypeDefinition>
subpackages: map<commons.SubpackageId, ApiDefinitionSubpackage>
auth: optional<ApiAuth>
hasMultipleBaseUrls:
type: optional<boolean>
Expand All @@ -50,41 +50,39 @@ types:
ApiNavigationConfigItem:
union:
subpackage: ApiNavigationConfigSubpackage
endpointId: endpoint.EndpointId
websocketId: websocket.WebSocketId
webhookId: webhook.WebhookId
endpointId: rootCommons.EndpointId
websocketId: rootCommons.WebSocketId
webhookId: rootCommons.WebhookId

ApiNavigationConfigSubpackage:
properties:
subpackageId: SubpackageId
subpackageId: commons.SubpackageId
items: list<ApiNavigationConfigItem>

ApiDefinitionPackage:
properties:
endpoints: list<endpoint.EndpointDefinition>
websockets: list<websocket.WebSocketChannel>
webhooks: list<webhook.WebhookDefinition>
types: list<type.TypeId>
subpackages: list<SubpackageId>
types: list<commons.TypeId>
subpackages: list<commons.SubpackageId>
pointsTo:
docs: |
if present, this package should be replaced with the provided subpackage
in the docs navigation.
type: optional<SubpackageId>
type: optional<commons.SubpackageId>

ApiDefinitionSubpackage:
extends:
- commons.WithDescription
- ApiDefinitionPackage
properties:
parent: optional<SubpackageId>
subpackageId: SubpackageId
parent: optional<commons.SubpackageId>
subpackageId: commons.SubpackageId
name: string
urlSlug: string
displayName: optional<string>

SubpackageId: string

ApiAuth:
union:
bearerAuth: BearerAuth
Expand Down Expand Up @@ -119,7 +117,7 @@ types:

OAuthClientCredentialsReferencedEndpoint:
properties:
endpointId: endpoint.EndpointId
endpointId: rootCommons.EndpointId
accessTokenLocator: commons.JqString

errors:
Expand Down
22 changes: 0 additions & 22 deletions fern/apis/fdr/definition/api/v1/read/commons.yml

This file was deleted.

42 changes: 11 additions & 31 deletions fern/apis/fdr/definition/api/v1/read/endpoint.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

imports:
rootCommons: ../../../commons.yml
type: type.yml
commons: commons.yml
commons: ../commons.yml
snippetTemplate: ../../../templates.yml

types:
EnvironmentId: string

EndpointId: string

EndpointDefinition:
extends: commons.WithDescription
properties:
authed:
type: boolean
docs: When this is true, the api definition will have a union for auth
availability: optional<commons.Availability>
defaultEnvironment: optional<EnvironmentId>
environments: list<Environment>
method: HttpMethod
id: EndpointId
defaultEnvironment: optional<rootCommons.EnvironmentId>
environments: list<commons.Environment>
method: rootCommons.HttpMethod
id: rootCommons.EndpointId
originalEndpointId: optional<string>
urlSlug: string
migratedFromUrlSlugs: optional<list<string>>
Expand All @@ -42,19 +39,6 @@ types:
typescript: optional<snippetTemplate.VersionedSnippetTemplate>
python: optional<snippetTemplate.VersionedSnippetTemplate>

Environment:
properties:
id: EnvironmentId
baseUrl: string

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

EndpointPath:
properties:
parts: list<EndpointPathPart>
Expand All @@ -63,18 +47,16 @@ types:
EndpointPathPart:
union:
literal: string
pathParameter: PathParameterKey
pathParameter: commons.PathParameterKey

PathParameter:
extends:
- commons.WithDescription
- commons.WithAvailability
properties:
key: PathParameterKey
key: commons.PathParameterKey
type: type.TypeReference

PathParameterKey: string

QueryParameter:
extends:
- commons.WithDescription
Expand Down Expand Up @@ -168,7 +150,7 @@ types:

StreamCondition:
union:
booleanRequestProperty: type.PropertyKey
booleanRequestProperty: commons.PropertyKey

ErrorDeclaration:
extends:
Expand All @@ -194,7 +176,7 @@ types:
properties:
name: optional<string>
path: string
pathParameters: map<PathParameterKey, unknown>
pathParameters: map<commons.PathParameterKey, unknown>
queryParameters: map<string, unknown>
headers: map<string, unknown>
requestBody: unknown
Expand Down Expand Up @@ -262,9 +244,7 @@ types:
FilenameWithData:
properties:
filename: string
data: FileId

FileId: string
data: rootCommons.FileId

ExampleEndpointResponse:
union:
Expand Down
Loading

0 comments on commit ad0a7a0

Please sign in to comment.