Skip to content

Commit

Permalink
feat: update fdr types to accomodate extra properties type reference (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
RohinBhargava authored Oct 8, 2024
1 parent 389e723 commit 974bc61
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions fern/apis/fdr/definition/api/latest/type.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ types:
properties:
extends: list<rootCommons.TypeId>
properties: list<ObjectProperty>
extraProperties: optional<TypeReference>

ObjectProperty:
extends:
Expand Down
6 changes: 6 additions & 0 deletions packages/fdr-sdk/src/api-definition/__test__/unwrap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ describe("unwrapObjectType", () => {
availability: undefined,
},
],
extraProperties: undefined,
};

expect(unwrapObjectType(shape, {}).properties.map((p) => p.key)).toStrictEqual([
Expand Down Expand Up @@ -323,6 +324,7 @@ describe("unwrapObjectType", () => {
availability: undefined,
},
],
extraProperties: undefined,
};
const types: Record<TypeId, TypeDefinition> = {
[TypeId("b")]: {
Expand All @@ -338,6 +340,7 @@ describe("unwrapObjectType", () => {
availability: undefined,
},
],
extraProperties: undefined,
},
description: undefined,
availability: undefined,
Expand All @@ -355,6 +358,7 @@ describe("unwrapObjectType", () => {
availability: undefined,
},
],
extraProperties: undefined,
},
description: undefined,
availability: undefined,
Expand All @@ -380,6 +384,7 @@ describe("unwrapObjectType", () => {
availability: undefined,
},
],
extraProperties: undefined,
};
const types: Record<TypeId, TypeDefinition> = {
[TypeId("b")]: {
Expand Down Expand Up @@ -422,6 +427,7 @@ describe("unwrapObjectType", () => {
availability: undefined,
},
],
extraProperties: undefined,
},
description: "description-2",
availability: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/fdr-sdk/src/api-definition/migrators/v1ToV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export class ApiDefinitionV1ToLatest {
type: "object",
extends: value.extends,
properties: this.migrateObjectProperties(value.properties),
extraProperties: undefined,
}),
alias: (value) => ({
type: "alias",
Expand All @@ -305,6 +306,7 @@ export class ApiDefinitionV1ToLatest {
availability: variant.availability,
extends: variant.additionalProperties.extends,
properties: this.migrateObjectProperties(variant.additionalProperties.properties),
extraProperties: undefined,
})),
}),
});
Expand Down Expand Up @@ -483,6 +485,7 @@ export class ApiDefinitionV1ToLatest {
type: "object",
extends: value.extends,
properties: this.migrateObjectProperties(value.properties),
extraProperties: undefined,
}),
reference: (value) => ({
type: "alias",
Expand Down Expand Up @@ -519,6 +522,7 @@ export class ApiDefinitionV1ToLatest {
type: "object",
extends: value.extends,
properties: this.migrateObjectProperties(value.properties),
extraProperties: undefined,
}),
reference: (value) => ({
type: "alias",
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.

0 comments on commit 974bc61

Please sign in to comment.