diff --git a/packages/cli/generation/ir-generator/src/examples/generator/generatePrimitiveExample.ts b/packages/cli/generation/ir-generator/src/examples/generator/generatePrimitiveExample.ts index de0f2f35a46..0a0c73d138f 100644 --- a/packages/cli/generation/ir-generator/src/examples/generator/generatePrimitiveExample.ts +++ b/packages/cli/generation/ir-generator/src/examples/generator/generatePrimitiveExample.ts @@ -116,7 +116,12 @@ function maybeIntegerValidation(v2: PrimitiveTypeV2 | undefined): IntegerValidat function getStringExampleOfLength(length: number): string { if (length <= Examples.SAMPLE_STRINGS.length) { - return Examples.SAMPLE_STRINGS[length - 1]!; + const sampleString = Examples.SAMPLE_STRINGS[length - 1]; + if (sampleString) { + return sampleString; + } else { + throw new Error(`Unexpected undefined value in SAMPLE_STRINGS at index ${length - 1}`); + } } return ( Examples.SAMPLE_STRINGS[Examples.SAMPLE_STRINGS.length - 1] + @@ -170,7 +175,6 @@ function generatePrimitiveDoubleExample({ return { type: "success", example: ExamplePrimitive.double(minimum), jsonExample: minimum }; } } - const jsonExample = fieldName ?? Examples.DOUBLE; return { type: "success", example: ExamplePrimitive.double(Examples.DOUBLE), jsonExample: Examples.DOUBLE }; } @@ -190,6 +194,5 @@ function generatePrimitiveIntegerExample({ return { type: "success", example: ExamplePrimitive.integer(minimum), jsonExample: minimum }; } } - const jsonExample = fieldName ?? Examples.DOUBLE; return { type: "success", example: ExamplePrimitive.integer(Examples.INT), jsonExample: Examples.INT }; } diff --git a/seed/go-sdk/validation/dynamic-snippets/example0/snippet.go b/seed/go-sdk/validation/dynamic-snippets/example0/snippet.go index 731252b47a6..8a19814558b 100644 --- a/seed/go-sdk/validation/dynamic-snippets/example0/snippet.go +++ b/seed/go-sdk/validation/dynamic-snippets/example0/snippet.go @@ -13,7 +13,7 @@ func do() () { &fern.CreateRequest{ Decimal: 2.2, Even: 100, - Name: "aaaaaaaaaa", + Name: "string....", Shape: fern.ShapeSquare, }, ) diff --git a/seed/go-sdk/validation/dynamic-snippets/example1/snippet.go b/seed/go-sdk/validation/dynamic-snippets/example1/snippet.go index c46e0769e45..95208a6f071 100644 --- a/seed/go-sdk/validation/dynamic-snippets/example1/snippet.go +++ b/seed/go-sdk/validation/dynamic-snippets/example1/snippet.go @@ -13,7 +13,7 @@ func do() () { &fern.GetRequest{ Decimal: 2.2, Even: 100, - Name: "aaaaaaaaaa", + Name: "string....", }, ) } diff --git a/seed/go-sdk/validation/snippet.json b/seed/go-sdk/validation/snippet.json index 229859d7277..2ef492ab494 100644 --- a/seed/go-sdk/validation/snippet.json +++ b/seed/go-sdk/validation/snippet.json @@ -8,7 +8,7 @@ }, "snippet": { "type": "go", - "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/validation/fern\"\n\tfernclient \"github.com/validation/fern/client\"\n)\n\nclient := fernclient.NewClient()\nresponse, err := client.Get(\n\tcontext.TODO(),\n\t\u0026fern.GetRequest{\n\t\tDecimal: 2.2,\n\t\tEven: 100,\n\t\tName: \"aaaaaaaaaa\",\n\t},\n)\n" + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/validation/fern\"\n\tfernclient \"github.com/validation/fern/client\"\n)\n\nclient := fernclient.NewClient()\nresponse, err := client.Get(\n\tcontext.TODO(),\n\t\u0026fern.GetRequest{\n\t\tDecimal: 2.2,\n\t\tEven: 100,\n\t\tName: \"string....\",\n\t},\n)\n" } }, { @@ -19,7 +19,7 @@ }, "snippet": { "type": "go", - "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/validation/fern\"\n\tfernclient \"github.com/validation/fern/client\"\n)\n\nclient := fernclient.NewClient()\nresponse, err := client.Create(\n\tcontext.TODO(),\n\t\u0026fern.CreateRequest{\n\t\tDecimal: 2.2,\n\t\tEven: 100,\n\t\tName: \"aaaaaaaaaa\",\n\t\tShape: fern.ShapeSquare,\n\t},\n)\n" + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/validation/fern\"\n\tfernclient \"github.com/validation/fern/client\"\n)\n\nclient := fernclient.NewClient()\nresponse, err := client.Create(\n\tcontext.TODO(),\n\t\u0026fern.CreateRequest{\n\t\tDecimal: 2.2,\n\t\tEven: 100,\n\t\tName: \"string....\",\n\t\tShape: fern.ShapeSquare,\n\t},\n)\n" } } ] diff --git a/seed/postman/validation/collection.json b/seed/postman/validation/collection.json index 9c5f25ea7c3..98e1fe6892c 100644 --- a/seed/postman/validation/collection.json +++ b/seed/postman/validation/collection.json @@ -40,7 +40,7 @@ "auth": null, "body": { "mode": "raw", - "raw": "{\n \"decimal\": 2.2,\n \"even\": 100,\n \"name\": \"aaaaaaaaaa\",\n \"shape\": \"SQUARE\"\n}", + "raw": "{\n \"decimal\": 2.2,\n \"even\": 100,\n \"name\": \"string....\",\n \"shape\": \"SQUARE\"\n}", "options": { "raw": { "language": "json" @@ -77,7 +77,7 @@ "auth": null, "body": { "mode": "raw", - "raw": "{\n \"decimal\": 2.2,\n \"even\": 100,\n \"name\": \"aaaaaaaaaa\",\n \"shape\": \"SQUARE\"\n}", + "raw": "{\n \"decimal\": 2.2,\n \"even\": 100,\n \"name\": \"string....\",\n \"shape\": \"SQUARE\"\n}", "options": { "raw": { "language": "json" @@ -86,7 +86,7 @@ } }, "description": null, - "body": "{\n \"decimal\": 2.2,\n \"even\": 100,\n \"name\": \"aaaaaaaaaa\",\n \"shape\": \"SQUARE\"\n}", + "body": "{\n \"decimal\": 2.2,\n \"even\": 100,\n \"name\": \"string....\",\n \"shape\": \"SQUARE\"\n}", "_postman_previewlanguage": "json" } ] @@ -97,7 +97,7 @@ "request": { "description": null, "url": { - "raw": "{{baseUrl}}?decimal=2.2&even=100&name=aaaaaaaaaa", + "raw": "{{baseUrl}}?decimal=2.2&even=100&name=string....", "host": [ "{{baseUrl}}" ], @@ -116,7 +116,7 @@ { "key": "name", "description": null, - "value": "aaaaaaaaaa" + "value": "string...." } ], "variable": [] @@ -140,7 +140,7 @@ "originalRequest": { "description": null, "url": { - "raw": "{{baseUrl}}?decimal=2.2&even=100&name=aaaaaaaaaa", + "raw": "{{baseUrl}}?decimal=2.2&even=100&name=string....", "host": [ "{{baseUrl}}" ], @@ -159,7 +159,7 @@ { "key": "name", "description": null, - "value": "aaaaaaaaaa" + "value": "string...." } ], "variable": [] @@ -176,7 +176,7 @@ "body": null }, "description": null, - "body": "{\n \"decimal\": 2.2,\n \"even\": 100,\n \"name\": \"aaaaaaaaaa\",\n \"shape\": \"SQUARE\"\n}", + "body": "{\n \"decimal\": 2.2,\n \"even\": 100,\n \"name\": \"string....\",\n \"shape\": \"SQUARE\"\n}", "_postman_previewlanguage": "json" } ] diff --git a/seed/ruby-sdk/validation/lib/fern_validation.rb b/seed/ruby-sdk/validation/lib/fern_validation.rb index 83c0448b38b..845cc497e20 100644 --- a/seed/ruby-sdk/validation/lib/fern_validation.rb +++ b/seed/ruby-sdk/validation/lib/fern_validation.rb @@ -30,7 +30,7 @@ def initialize(base_url: nil, max_retries: nil, timeout_in_seconds: nil) # validation.create( # decimal: 2.2, # even: 100, - # name: "aaaaaaaaaa", + # name: "string....", # shape: SQUARE # ) def create(decimal:, even:, name:, shape:, request_options: nil) @@ -66,7 +66,7 @@ def create(decimal:, even:, name:, shape:, request_options: nil) # validation.get( # decimal: 2.2, # even: 100, - # name: "aaaaaaaaaa" + # name: "string...." # ) def get(decimal:, even:, name:, request_options: nil) response = @request_client.conn.get do |req| @@ -115,7 +115,7 @@ def initialize(base_url: nil, max_retries: nil, timeout_in_seconds: nil) # validation.create( # decimal: 2.2, # even: 100, - # name: "aaaaaaaaaa", + # name: "string....", # shape: SQUARE # ) def create(decimal:, even:, name:, shape:, request_options: nil) @@ -151,7 +151,7 @@ def create(decimal:, even:, name:, shape:, request_options: nil) # validation.get( # decimal: 2.2, # even: 100, - # name: "aaaaaaaaaa" + # name: "string...." # ) def get(decimal:, even:, name:, request_options: nil) response = @async_request_client.conn.get do |req| diff --git a/seed/ruby-sdk/validation/snippet.json b/seed/ruby-sdk/validation/snippet.json index 98a844ead85..655e9ff4fa2 100644 --- a/seed/ruby-sdk/validation/snippet.json +++ b/seed/ruby-sdk/validation/snippet.json @@ -7,7 +7,7 @@ "identifierOverride": "endpoint_.create" }, "snippet": { - "client": "require \"fern_validation\"\n\nvalidation = SeedValidationClient::Client.new(base_url: \"https://api.example.com\")\nvalidation.create(\n decimal: 2.2,\n even: 100,\n name: \"aaaaaaaaaa\",\n shape: SQUARE\n)", + "client": "require \"fern_validation\"\n\nvalidation = SeedValidationClient::Client.new(base_url: \"https://api.example.com\")\nvalidation.create(\n decimal: 2.2,\n even: 100,\n name: \"string....\",\n shape: SQUARE\n)", "type": "ruby" } }, @@ -18,7 +18,7 @@ "identifierOverride": "endpoint_.get" }, "snippet": { - "client": "require \"fern_validation\"\n\nvalidation = SeedValidationClient::Client.new(base_url: \"https://api.example.com\")\nvalidation.get(\n decimal: 2.2,\n even: 100,\n name: \"aaaaaaaaaa\"\n)", + "client": "require \"fern_validation\"\n\nvalidation = SeedValidationClient::Client.new(base_url: \"https://api.example.com\")\nvalidation.get(\n decimal: 2.2,\n even: 100,\n name: \"string....\"\n)", "type": "ruby" } }, @@ -29,7 +29,7 @@ "identifierOverride": "endpoint_.create" }, "snippet": { - "client": "require \"fern_validation\"\n\nvalidation = SeedValidationClient::Client.new(base_url: \"https://api.example.com\")\nvalidation.create(\n decimal: 2.2,\n even: 100,\n name: \"aaaaaaaaaa\",\n shape: SQUARE\n)", + "client": "require \"fern_validation\"\n\nvalidation = SeedValidationClient::Client.new(base_url: \"https://api.example.com\")\nvalidation.create(\n decimal: 2.2,\n even: 100,\n name: \"string....\",\n shape: SQUARE\n)", "type": "ruby" } }, @@ -40,7 +40,7 @@ "identifierOverride": "endpoint_.get" }, "snippet": { - "client": "require \"fern_validation\"\n\nvalidation = SeedValidationClient::Client.new(base_url: \"https://api.example.com\")\nvalidation.get(\n decimal: 2.2,\n even: 100,\n name: \"aaaaaaaaaa\"\n)", + "client": "require \"fern_validation\"\n\nvalidation = SeedValidationClient::Client.new(base_url: \"https://api.example.com\")\nvalidation.get(\n decimal: 2.2,\n even: 100,\n name: \"string....\"\n)", "type": "ruby" } } diff --git a/seed/ts-sdk/validation/README.md b/seed/ts-sdk/validation/README.md index 7413da9899b..6bc5dfde440 100644 --- a/seed/ts-sdk/validation/README.md +++ b/seed/ts-sdk/validation/README.md @@ -26,7 +26,7 @@ const client = new SeedValidationClient({ environment: "YOUR_BASE_URL" }); await client.create({ decimal: 2.2, even: 100, - name: "aaaaaaaaaa", + name: "string....", shape: "SQUARE", }); ``` diff --git a/seed/ts-sdk/validation/reference.md b/seed/ts-sdk/validation/reference.md index d5ef902be48..eb77bcfdd48 100644 --- a/seed/ts-sdk/validation/reference.md +++ b/seed/ts-sdk/validation/reference.md @@ -16,7 +16,7 @@ await client.get({ decimal: 2.2, even: 100, - name: "aaaaaaaaaa", + name: "string....", }); ``` diff --git a/seed/ts-sdk/validation/resolved-snippet-templates.md b/seed/ts-sdk/validation/resolved-snippet-templates.md index ebe26148c6f..98993923160 100644 --- a/seed/ts-sdk/validation/resolved-snippet-templates.md +++ b/seed/ts-sdk/validation/resolved-snippet-templates.md @@ -5,7 +5,7 @@ const client = new SeedValidationClient({ environment: "YOUR_BASE_URL" }); await client.create({ decimal: 2.2, even: 100, - name: "aaaaaaaaaa", + name: "string....", }); ``` @@ -18,7 +18,7 @@ const client = new SeedValidationClient({ environment: "YOUR_BASE_URL" }); await client.get({ decimal: 2.2, even: 100, - name: "aaaaaaaaaa", + name: "string....", }); ``` diff --git a/seed/ts-sdk/validation/snippet.json b/seed/ts-sdk/validation/snippet.json index 868eaea5d47..7f7c9e4fade 100644 --- a/seed/ts-sdk/validation/snippet.json +++ b/seed/ts-sdk/validation/snippet.json @@ -8,7 +8,7 @@ }, "snippet": { "type": "typescript", - "client": "import { SeedValidationClient } from \"@fern/validation\";\n\nconst client = new SeedValidationClient({ environment: \"YOUR_BASE_URL\" });\nawait client.create({\n decimal: 2.2,\n even: 100,\n name: \"aaaaaaaaaa\",\n shape: \"SQUARE\"\n});\n" + "client": "import { SeedValidationClient } from \"@fern/validation\";\n\nconst client = new SeedValidationClient({ environment: \"YOUR_BASE_URL\" });\nawait client.create({\n decimal: 2.2,\n even: 100,\n name: \"string....\",\n shape: \"SQUARE\"\n});\n" } }, { @@ -19,7 +19,7 @@ }, "snippet": { "type": "typescript", - "client": "import { SeedValidationClient } from \"@fern/validation\";\n\nconst client = new SeedValidationClient({ environment: \"YOUR_BASE_URL\" });\nawait client.get({\n decimal: 2.2,\n even: 100,\n name: \"aaaaaaaaaa\"\n});\n" + "client": "import { SeedValidationClient } from \"@fern/validation\";\n\nconst client = new SeedValidationClient({ environment: \"YOUR_BASE_URL\" });\nawait client.get({\n decimal: 2.2,\n even: 100,\n name: \"string....\"\n});\n" } } ], diff --git a/seed/ts-sdk/validation/src/Client.ts b/seed/ts-sdk/validation/src/Client.ts index 6aeb3fd7475..6b181bd8545 100644 --- a/seed/ts-sdk/validation/src/Client.ts +++ b/seed/ts-sdk/validation/src/Client.ts @@ -36,7 +36,7 @@ export class SeedValidationClient { * await client.create({ * decimal: 2.2, * even: 100, - * name: "aaaaaaaaaa", + * name: "string....", * shape: "SQUARE" * }) */ @@ -109,7 +109,7 @@ export class SeedValidationClient { * await client.get({ * decimal: 2.2, * even: 100, - * name: "aaaaaaaaaa" + * name: "string...." * }) */ public get( diff --git a/seed/ts-sdk/validation/src/api/client/requests/CreateRequest.ts b/seed/ts-sdk/validation/src/api/client/requests/CreateRequest.ts index 6eddc182342..107e5638d83 100644 --- a/seed/ts-sdk/validation/src/api/client/requests/CreateRequest.ts +++ b/seed/ts-sdk/validation/src/api/client/requests/CreateRequest.ts @@ -9,7 +9,7 @@ import * as SeedValidation from "../../index"; * { * decimal: 2.2, * even: 100, - * name: "aaaaaaaaaa", + * name: "string....", * shape: "SQUARE" * } */ diff --git a/seed/ts-sdk/validation/src/api/client/requests/GetRequest.ts b/seed/ts-sdk/validation/src/api/client/requests/GetRequest.ts index 2a60deef0f1..2c839287d13 100644 --- a/seed/ts-sdk/validation/src/api/client/requests/GetRequest.ts +++ b/seed/ts-sdk/validation/src/api/client/requests/GetRequest.ts @@ -7,7 +7,7 @@ * { * decimal: 2.2, * even: 100, - * name: "aaaaaaaaaa" + * name: "string...." * } */ export interface GetRequest {