Skip to content

Commit

Permalink
feat, fern: allow headers to specify their envvar as well (#3061)
Browse files Browse the repository at this point in the history
  • Loading branch information
armandobelardo authored Feb 26, 2024
1 parent 518461f commit 805f92f
Show file tree
Hide file tree
Showing 70 changed files with 2,635 additions and 25 deletions.
10 changes: 10 additions & 0 deletions .pnp.cjs

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

33 changes: 25 additions & 8 deletions fern.schema.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,28 @@
"headers": {
"type": "object",
"additionalProperties": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/properties/additionalProperties"
"anyOf": [
{ "type": "string" },
{
"type": "object",
"properties": {
"type": { "type": "string" },
"docs": { "$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/docs" },
"availability": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/availability"
},
"audiences": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/audiences"
},
"name": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/examples/items/properties/name"
},
"env": { "type": "string" }
},
"required": ["type"],
"additionalProperties": false
}
]
}
},
"endpoints": {
Expand Down Expand Up @@ -413,7 +434,7 @@
"headers": {
"type": "object",
"additionalProperties": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/properties/additionalProperties"
"$ref": "#/properties/service/properties/headers/additionalProperties"
}
},
"body": {
Expand Down Expand Up @@ -666,9 +687,7 @@
"display-name": { "type": "string" },
"headers": {
"type": "object",
"additionalProperties": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/properties/additionalProperties"
}
"additionalProperties": { "$ref": "#/properties/service/properties/headers/additionalProperties" }
},
"payload": {
"anyOf": [
Expand Down Expand Up @@ -740,9 +759,7 @@
"display-name": { "type": "string" },
"headers": {
"type": "object",
"additionalProperties": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/properties/additionalProperties"
}
"additionalProperties": { "$ref": "#/properties/service/properties/headers/additionalProperties" }
},
"path-parameters": {
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12224,6 +12224,7 @@ exports[`ir {"name":"simple","audiences":["internal"]} 1`] = `
}
}
},
"env": null,
"availability": null,
"docs": null
}
Expand Down Expand Up @@ -13293,6 +13294,7 @@ exports[`ir {"name":"simple","audiences":["test"]} 1`] = `
}
}
},
"env": null,
"availability": null,
"docs": null
}
Expand Down Expand Up @@ -15778,6 +15780,7 @@ exports[`ir {"name":"simple"} 1`] = `
}
}
},
"env": null,
"availability": null,
"docs": null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1760,6 +1760,7 @@ exports[`generate IR 1`] = `
{
"availability": null,
"docs": null,
"env": null,
"name": {
"name": {
"camelCase": {
Expand Down Expand Up @@ -5473,6 +5474,7 @@ exports[`generate IR 1`] = `
{
"availability": null,
"docs": null,
"env": null,
"name": {
"name": {
"camelCase": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12004,6 +12004,7 @@ exports[`generate IR 1`] = `
{
"availability": null,
"docs": null,
"env": null,
"name": {
"name": {
"camelCase": {
Expand Down Expand Up @@ -12139,6 +12140,7 @@ exports[`generate IR 1`] = `
{
"availability": null,
"docs": null,
"env": null,
"name": {
"name": {
"camelCase": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ exports[`generate IR 1`] = `
{
"availability": null,
"docs": null,
"env": null,
"name": {
"name": {
"camelCase": {
Expand Down Expand Up @@ -118,6 +119,7 @@ exports[`generate IR 1`] = `
{
"availability": null,
"docs": null,
"env": null,
"name": {
"name": {
"camelCase": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ exports[`generate IR 1`] = `
{
"availability": null,
"docs": null,
"env": null,
"name": {
"name": {
"camelCase": {
Expand Down Expand Up @@ -98,6 +99,7 @@ exports[`generate IR 1`] = `
{
"availability": null,
"docs": null,
"env": null,
"name": {
"name": {
"camelCase": {
Expand Down Expand Up @@ -563,6 +565,7 @@ exports[`generate IR 1`] = `
{
"availability": null,
"docs": null,
"env": null,
"name": {
"name": {
"camelCase": {
Expand Down Expand Up @@ -599,6 +602,7 @@ exports[`generate IR 1`] = `
{
"availability": null,
"docs": null,
"env": null,
"name": {
"name": {
"camelCase": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ exports[`generate IR 1`] = `
{
"availability": null,
"docs": null,
"env": null,
"name": {
"name": {
"camelCase": {
Expand Down Expand Up @@ -4999,6 +5000,7 @@ exports[`generate IR 1`] = `
{
"availability": null,
"docs": null,
"env": null,
"name": {
"name": {
"camelCase": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ export async function convertHttpHeader({
wireValue: headerKey,
name
}),
valueType: file.parseTypeReference(header)
valueType: file.parseTypeReference(header),
env: typeof header === "string" ? undefined : header.env
};
}

Expand Down
1 change: 1 addition & 0 deletions packages/cli/generation/ir-migrations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"@fern-fern/ir-v32-sdk": "0.0.1",
"@fern-fern/ir-v33-sdk": "0.0.15",
"@fern-fern/ir-v34-sdk": "0.0.8",
"@fern-fern/ir-v35-sdk": "0.0.15",
"@fern-fern/ir-v4-model": "0.0.4",
"@fern-fern/ir-v5-model": "0.0.3",
"@fern-fern/ir-v6-model": "0.0.33",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { V32_TO_V31_MIGRATION } from "./migrations/v32-to-v31/migrateFromV32ToV3
import { V33_TO_V32_MIGRATION } from "./migrations/v33-to-v32/migrateFromV33ToV32";
import { V34_TO_V33_MIGRATION } from "./migrations/v34-to-v33/migrateFromV34ToV33";
import { V35_TO_V34_MIGRATION } from "./migrations/v35-to-v34/migrateFromV35ToV34";
import { V36_TO_V35_MIGRATION } from "./migrations/v36-to-v35/migrateFromV36ToV35";
import { V4_TO_V3_MIGRATION } from "./migrations/v4-to-v3/migrateFromV4ToV3";
import { V5_TO_V4_MIGRATION } from "./migrations/v5-to-v4/migrateFromV5ToV4";
import { V6_TO_V5_MIGRATION } from "./migrations/v6-to-v5/migrateFromV6ToV5";
Expand Down Expand Up @@ -261,6 +262,7 @@ const IntermediateRepresentationMigrator = {

const INTERMEDIATE_REPRESENTATION_MIGRATOR = IntermediateRepresentationMigrator.Builder
// put new migrations here
.withMigration(V36_TO_V35_MIGRATION)
.withMigration(V35_TO_V34_MIGRATION)
.withMigration(V34_TO_V33_MIGRATION)
.withMigration(V33_TO_V32_MIGRATION)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { FernIr as V35 } from "@fern-api/ir-sdk";
export { FernIr as V36 } from "@fern-api/ir-sdk";
export * as V1 from "@fern-fern/ir-v1-model";
export * as V10 from "@fern-fern/ir-v10-model";
export * as V11 from "@fern-fern/ir-v11-model";
Expand Down Expand Up @@ -27,6 +27,7 @@ export { FernIrV31 as V31 } from "@fern-fern/ir-v31-sdk";
export { FernIrV32 as V32 } from "@fern-fern/ir-v32-sdk";
export { FernIrV33 as V33 } from "@fern-fern/ir-v33-sdk";
export { FernIrV34 as V34 } from "@fern-fern/ir-v34-sdk";
export { FernIrV35 as V35 } from "@fern-fern/ir-v35-sdk";
export * as V4 from "@fern-fern/ir-v4-model";
export * as V5 from "@fern-fern/ir-v5-model";
export * as V6 from "@fern-fern/ir-v6-model";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10829,6 +10829,7 @@ exports[`migrateFromV23ToV22 migrates extensive 1`] = `
"status": "GENERAL_AVAILABILITY",
},
"docs": undefined,
"env": undefined,
"name": {
"name": {
"camelCase": {
Expand Down Expand Up @@ -10967,6 +10968,7 @@ exports[`migrateFromV23ToV22 migrates extensive 1`] = `
"status": "GENERAL_AVAILABILITY",
},
"docs": undefined,
"env": undefined,
"name": {
"name": {
"camelCase": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ exports[`migrateFromV30ToV29 snapshot 1`] = `
{
"availability": undefined,
"docs": undefined,
"env": undefined,
"name": {
"name": {
"camelCase": {
Expand Down
Loading

0 comments on commit 805f92f

Please sign in to comment.