Skip to content

Commit

Permalink
fix: CORS in API Playground proxy (#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity authored May 14, 2024
1 parent 067df36 commit 03bf2f1
Show file tree
Hide file tree
Showing 18 changed files with 427 additions and 224 deletions.
91 changes: 91 additions & 0 deletions fern/apis/proxy/definition/__package__.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

service:
auth: false
base-path: /api/fern-docs/proxy
endpoints:
rest:
path: /rest
display-name: Proxy REST
method: POST
request:
body: ProxyRequest
response: ProxyResponse
file:
path: /file
display-name: Proxy File
method: POST
request:
body: ProxyRequest
response: file
stream:
path: /stream
display-name: Proxy Stream
method: POST
request:
body: ProxyRequest
response-stream: unknown

types:
ProxyRequest:
properties:
url: string
method: string
headers: map<string, string>
body: RequestSerializableBody
stream: optional<boolean>
streamTerminator: optional<string>

ProxyResponse:
properties:
response: ResponseSerializableBody
time: integer
size: optional<string>

RequestSerializableBody:
union:
json: unknown
form-data: map<string, SerializableFormDataEntryValue>
octet-stream: SerializableFile

ResponseSerializableBody:
properties:
headers: map<string, string>
ok: boolean
redirected: boolean
status: integer
statusText: string
type: ResponseType
url: string

SerializableFormDataEntryValue:
union:
file: optional<SerializableFile>
fileArray: list<SerializableFileValue>
json: FormDataJsonEntry

FormDataJsonEntry:
properties:
value: unknown
contentType: optional<string>

SerializableFile:
properties:
value: SerializableFileValue

SerializableFileValue:
properties:
name: string
lastModified: integer
size: integer
type: string
dataUrl: base64

ResponseType:
enum:
- basic
- cors
- default
- error
- opaque
- opaqueredirect
1 change: 1 addition & 0 deletions fern/apis/proxy/definition/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name: proxy
15 changes: 15 additions & 0 deletions fern/apis/proxy/generators.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
default-group: sdk
groups:
sdk:
generators: []
# - name: fernapi/fern-typescript-node-sdk
# version: 0.17.1
# output:
# location: npm
# url: npm.buildwithfern.com
# package-name: "@fern-fern/proxy-sdk"
# config:
# skipResponseValidation: true
# outputEsm: true
# noSerdeLayer: true
# noOptionalProperties: true
5 changes: 4 additions & 1 deletion fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ navigation:
contents:
- page: Enable API Playground
path: ./docs/pages/enable-api-playground.mdx
- page: Configure Custom Domain
- page: Configure Custom Domain
path: ./docs/pages/configure-custom-domain.mdx
- api: FDR API Reference
api-name: fdr
display-errors: true
- api: Revalidation API Reference
api-name: revalidation
display-errors: true
- api: Proxy API Reference
api-name: proxy
display-errors: true

colors:
accentPrimary:
Expand Down
2 changes: 1 addition & 1 deletion fern/fern.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"organization": "fern",
"version": "0.23.0"
"version": "0.26.7"
}
Loading

0 comments on commit 03bf2f1

Please sign in to comment.