Skip to content

Commit

Permalink
fix(cli): Add availability to inline request body properties (#4636)
Browse files Browse the repository at this point in the history
  • Loading branch information
RohinBhargava authored Sep 13, 2024
1 parent 71335d1 commit 27fb378
Show file tree
Hide file tree
Showing 68 changed files with 2,120 additions and 33 deletions.
55 changes: 55 additions & 0 deletions packages/cli/cli/versions.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,58 @@
- changelogEntry:
- summary: |
Adds availability to inlined properties for HTTP Requests, Webhooks, and WebSockets for Fern Definition and OpenAPI.
You can add availability like so:
Fern Definition:
```yml
Request:
name: InlineRequest
properties:
random:
type: string
availability: pre-release
```
OpenAPI:
```yml
requestBody:
content:
application/json:
schema:
type: object
properties:
random:
type: string
x-fern-availability: beta
```
type: feat
irVersion: 53
version: 0.41.12

- changelogEntry:
- summary: |
Adds availability and display-names to discriminated union values. Now, in your docs, you can mark your union values
with custom names and show their availability. You can do so by adding the following to your API definition:
```yml
MyUnionType:
union:
UnionValue1:
docs: The first union value
type: string
display-name: Union Value One
availability: beta
UnionValue2:
docs: The second union value
type: integer
display-name: Union Value Two
availability: deprecated
```
type: feat
irVersion: 53
version: 0.41.11

- changelogEntry:
- summary: |
Adds availability and display-names to discriminated union values. Now, in your docs, you can mark your union values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -872,4 +872,4 @@ exports[`dependencies > correctly incorporates dependencies 1`] = `
}"
`;

exports[`dependencies > file dependencies 1`] = `3086104`;
exports[`dependencies > file dependencies 1`] = `3086374`;
Original file line number Diff line number Diff line change
Expand Up @@ -1547,6 +1547,7 @@ exports[`ir > {"name":"file-upload"} 1`] = `
}
}
},
"availability": null,
"docs": null
},
{
Expand Down Expand Up @@ -1642,6 +1643,7 @@ exports[`ir > {"name":"file-upload"} 1`] = `
}
}
},
"availability": null,
"docs": null
}
]
Expand Down Expand Up @@ -35094,6 +35096,7 @@ exports[`ir > {"name":"streaming"} 1`] = `
"v2": null
}
},
"availability": null,
"docs": null
}
],
Expand Down Expand Up @@ -36792,6 +36795,7 @@ exports[`ir > {"name":"webhooks"} 1`] = `
}
}
},
"availability": null,
"docs": null
},
{
Expand Down Expand Up @@ -36824,6 +36828,7 @@ exports[`ir > {"name":"webhooks"} 1`] = `
"v2": null
}
},
"availability": null,
"docs": "Some docs about urgency"
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { MediaType } from "@fern-api/core-utils";
import { HttpInlineRequestBodySchema, HttpRequestSchema, ObjectPropertySchema } from "../schemas";
import {
AvailabilityUnionSchema,
HttpInlineRequestBodySchema,
HttpRequestSchema,
ObjectPropertySchema
} from "../schemas";
import { isInlineRequestBody } from "./isInlineRequestBody";
import { parseRawFileType } from "./parseRawFileType";

Expand All @@ -25,6 +30,7 @@ export declare namespace RawFileUploadRequest {

export interface BaseProperty {
docs: string | undefined;
availability?: AvailabilityUnionSchema | undefined;
key: string;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name: availability
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

service:
auth: false
base-path: ""
endpoints:
test-availability:
path: /test-availability
method: POST
request:
name: RequestObject
body:
properties:
random:
type: string
availability: pre-release
response: string

types:
Object:
properties:
id:
type: string
availability: pre-release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,13 @@ it("generics", async () => {
workspaceName: "generics"
});
}, 200_000);

it("availability", async () => {
const AVAILABILITY_DIR = path.join(__dirname, "fixtures/availability/fern");
await generateAndSnapshotIRFromPath({
absolutePathToIr: AbsoluteFilePath.of(IR_DIR),
absolutePathToWorkspace: AbsoluteFilePath.of(AVAILABILITY_DIR),
audiences: { type: "all" },
workspaceName: "availability"
});
}, 200_000);
Loading

0 comments on commit 27fb378

Please sign in to comment.