Skip to content

Commit

Permalink
chore: Add snippetsConfiguration to ApiDefinitionLatest (#2167)
Browse files Browse the repository at this point in the history
  • Loading branch information
RohinBhargava authored Feb 14, 2025
1 parent 697fb16 commit 6a9e227
Show file tree
Hide file tree
Showing 16 changed files with 331 additions and 78 deletions.
3 changes: 2 additions & 1 deletion fern/apis/fdr/definition/api/latest/__package__.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ imports:
commons: commons.yml
rootCommons: ../../commons.yml
auth: auth.yml

v1Register: ../v1/register/__package__.yml
service:
base-path: /registry/api/latest
auth: true
Expand All @@ -35,6 +35,7 @@ types:
subpackages: map<commons.SubpackageId, commons.SubpackageMetadata>
auths: map<auth.AuthSchemeId, auth.AuthScheme>
globalHeaders: optional<list<type.ObjectProperty>>
snippetsConfiguration: optional<v1Register.SnippetsConfig>

errors:
ApiDoesNotExistError:
Expand Down
3 changes: 3 additions & 0 deletions packages/fdr-sdk/src/api-definition/__test__/join.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ const api1: Latest.ApiDefinition = {
availability: undefined,
},
],
snippetsConfiguration: undefined,
};

const api2: Latest.ApiDefinition = {
Expand Down Expand Up @@ -251,6 +252,7 @@ const api2: Latest.ApiDefinition = {
availability: undefined,
},
],
snippetsConfiguration: undefined,
};

const api3: Latest.ApiDefinition = {
Expand Down Expand Up @@ -281,6 +283,7 @@ const api3: Latest.ApiDefinition = {
availability: undefined,
},
],
snippetsConfiguration: undefined,
};

describe("join", () => {
Expand Down
1 change: 1 addition & 0 deletions packages/fdr-sdk/src/api-definition/__test__/prune.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ const api: Latest.ApiDefinition = {
availability: undefined,
},
],
snippetsConfiguration: undefined,
};

describe("prune", () => {
Expand Down
3 changes: 3 additions & 0 deletions packages/fdr-sdk/src/api-definition/join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export function joiner(
subpackages: { ...first.subpackages },
auths: { ...first.auths },
globalHeaders: first.globalHeaders ? [...first.globalHeaders] : undefined,
snippetsConfiguration: first.snippetsConfiguration
? { ...first.snippetsConfiguration }
: undefined,
};

let isJoined = false;
Expand Down
1 change: 1 addition & 0 deletions packages/fdr-sdk/src/api-definition/migrators/v1ToV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export class ApiDefinitionV1ToLatest {
subpackages: this.subpackages,
auths: this.v1.auth ? { [AUTH_SCHEME_ID]: this.v1.auth } : {},
globalHeaders: this.migrateParameters(this.v1.globalHeaders),
snippetsConfiguration: undefined,
};
};

Expand Down
1 change: 1 addition & 0 deletions packages/fdr-sdk/src/api-definition/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export class Transformer {
globalHeaders,
auths: api.auths,
subpackages: api.subpackages,
snippetsConfiguration: api.snippetsConfiguration,
};
};

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ describe("curl snippet generation", () => {
const apiDefinition = await loader
.withApiDefinition({
id: ApiDefinitionId("id"),
snippetsConfiguration: undefined,
webhooks: {},
websockets: {},
types: {},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export class OpenApiDocumentConverterNode extends BaseOpenApiV3_1ConverterNode<
subpackages,
auths: { ...auths, ...(this.auth?.convert() ?? {}) },
globalHeaders: this.globalHeaders?.convert(),
snippetsConfiguration: undefined,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export class OpenrpcDocumentConverterNode extends BaseOpenrpcConverterNode<
subpackages,
auths: {},
globalHeaders: [],
snippetsConfiguration: undefined,
};
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6a9e227

Please sign in to comment.