Skip to content

Commit

Permalink
fix(cli): content-type defaults to first value when provided as com…
Browse files Browse the repository at this point in the history
…ma-delineated string (#5219)

* Build endpoint uses first content-type value when provided a comma-delineated list.

* chore: update changelog

---------

Co-authored-by: fern-bot <[email protected]>
  • Loading branch information
eyw520 and fern-bot authored Nov 19, 2024
1 parent 8713b7b commit 8f96b43
Show file tree
Hide file tree
Showing 10 changed files with 554 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fern/pages/changelogs/cli/2024-11-18.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 0.45.0-rc45
## 0.45.0-rc46
**`(fix):`** The IR handles converting example unions that are aliases.


4 changes: 4 additions & 0 deletions fern/pages/changelogs/cli/2024-11-19.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 0.45.0-rc47
**`(fix):`** Support SDK generation provided comma-delineated content-type values in OpenAPI specs.


Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
{
"absoluteFilePath": "/DUMMY_PATH",
"importedDefinitions": {},
"namedDefinitionFiles": {
"__package__.yml": {
"absoluteFilepath": "/DUMMY_PATH",
"contents": {
"service": {
"auth": false,
"base-path": "",
"endpoints": {
"testUpload": {
"auth": false,
"display-name": "Test upload",
"docs": "Test multipart request with different content types.
",
"examples": [
{
"path-parameters": {
"corpus_key": "corpus_key",
},
"request": {},
"response": {
"body": "string",
},
},
],
"method": "POST",
"pagination": undefined,
"path": "/test",
"path-parameters": {
"corpus_key": {
"docs": "The unique key",
"type": "string",
},
},
"request": {
"body": {
"properties": {
"chunking_strategy": "optional<unknown>",
"file": {
"content-type": "application/octet-stream",
"docs": "Binary file contents. The file name of the file will be used as the document ID.",
"type": "file",
},
"filename": {
"docs": "Optional multipart section to override the filename.",
"type": "optional<string>",
},
"metadata": {
"docs": "Arbitrary object that will be attached as document metadata to the extracted document.",
"type": "optional<map<string, unknown>>",
},
},
},
"content-type": "multipart/form-data",
"headers": undefined,
"name": "PostTestRequest",
"query-parameters": undefined,
},
"response": {
"docs": "The sample response",
"type": "string",
},
"source": {
"openapi": "../openapi.yml",
},
},
},
"source": {
"openapi": "../openapi.yml",
},
},
},
"rawContents": "service:
auth: false
base-path: ''
endpoints:
testUpload:
path: /test
method: POST
auth: false
docs: |
Test multipart request with different content types.
source:
openapi: ../openapi.yml
path-parameters:
corpus_key:
type: string
docs: The unique key
display-name: Test upload
request:
name: PostTestRequest
body:
properties:
metadata:
type: optional<map<string, unknown>>
docs: >-
Arbitrary object that will be attached as document metadata to
the extracted document.
chunking_strategy: optional<unknown>
filename:
type: optional<string>
docs: Optional multipart section to override the filename.
file:
type: file
docs: >-
Binary file contents. The file name of the file will be used as
the document ID.
content-type: application/octet-stream
content-type: multipart/form-data
response:
docs: The sample response
type: string
examples:
- path-parameters:
corpus_key: corpus_key
request: {}
response:
body: string
source:
openapi: ../openapi.yml
",
},
},
"packageMarkers": {},
"rootApiFile": {
"contents": {
"display-name": "Test content-type parsing.",
"error-discrimination": {
"strategy": "status-code",
},
"name": "api",
},
"defaultUrl": undefined,
"rawContents": "name: api
error-discrimination:
strategy: status-code
display-name: Test content-type parsing.
",
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
{
"title": "Test content-type parsing.",
"servers": [],
"tags": {
"tagsById": {}
},
"hasEndpointsMarkedInternal": false,
"endpoints": [
{
"summary": "Test upload",
"audiences": [],
"tags": [],
"pathParameters": [
{
"description": "The unique key",
"name": "corpus_key",
"schema": {
"schema": {
"type": "string"
},
"generatedName": "PostTestRequestCorpusKey",
"groupName": [],
"type": "primitive"
},
"source": {
"file": "../openapi.yml",
"type": "openapi"
}
}
],
"queryParameters": [],
"headers": [],
"generatedRequestName": "PostTestRequest",
"request": {
"properties": [
{
"key": "metadata",
"schema": {
"value": {
"generatedName": "postTestRequestMetadata",
"value": {
"generatedName": "PostTestRequestMetadata",
"description": "Arbitrary object that will be attached as document metadata to the extracted document.",
"key": {
"generatedName": "PostTestRequestMetadataKey",
"schema": {
"type": "string"
}
},
"value": {
"generatedName": "PostTestRequestMetadataValue",
"type": "unknown"
},
"groupName": [],
"type": "map"
},
"groupName": [],
"type": "optional"
},
"type": "json"
}
},
{
"key": "chunking_strategy",
"schema": {
"value": {
"generatedName": "postTestRequestChunkingStrategy",
"value": {
"generatedName": "PostTestRequestChunkingStrategy",
"schema": "ChunkingStrategy",
"source": {
"file": "../openapi.yml",
"type": "openapi"
},
"type": "reference"
},
"groupName": [],
"type": "optional"
},
"type": "json"
}
},
{
"key": "filename",
"schema": {
"value": {
"generatedName": "postTestRequestFilename",
"value": {
"generatedName": "PostTestRequestFilename",
"schema": {
"type": "string"
},
"description": "Optional multipart section to override the filename.",
"groupName": [],
"type": "primitive"
},
"groupName": [],
"type": "optional"
},
"type": "json"
}
},
{
"key": "file",
"schema": {
"isOptional": false,
"isArray": false,
"type": "file"
},
"description": "Binary file contents. The file name of the file will be used as the document ID.",
"contentType": "application/octet-stream, application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.oasis.opendocument.text, application/epub+zip, application/rtf, text/html, text/plain, application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation, text/markdown"
}
],
"source": {
"file": "../openapi.yml",
"type": "openapi"
},
"type": "multipart"
},
"response": {
"description": "The sample response",
"schema": {
"schema": {
"type": "string"
},
"generatedName": "PostTestResponse",
"groupName": [],
"type": "primitive"
},
"fullExamples": [],
"source": {
"file": "../openapi.yml",
"type": "openapi"
},
"type": "json"
},
"errors": {},
"server": [],
"description": "Test multipart request with different content types.\n",
"authed": false,
"method": "POST",
"path": "/test",
"examples": [
{
"pathParameters": [
{
"name": "corpus_key",
"value": {
"value": {
"value": "corpus_key",
"type": "string"
},
"type": "primitive"
}
}
],
"queryParameters": [],
"headers": [],
"request": {
"properties": {},
"type": "object"
},
"response": {
"value": {
"value": {
"value": "string",
"type": "string"
},
"type": "primitive"
},
"type": "withoutStreaming"
},
"codeSamples": [],
"type": "full"
}
],
"source": {
"file": "../openapi.yml",
"type": "openapi"
}
}
],
"webhooks": [],
"channel": [],
"groupedSchemas": {
"rootSchemas": {},
"namespacedSchemas": {}
},
"variables": {},
"nonRequestReferencedSchemas": {},
"securitySchemes": {},
"globalHeaders": [],
"idempotencyHeaders": [],
"groups": {}
}
Loading

0 comments on commit 8f96b43

Please sign in to comment.