Skip to content

Commit 01be923

Browse files
feat(cli): add ENDPOINT_SECURITY value to AuthSchemesRequirement enum (#11310)
Co-authored-by: Niels Swimberghe <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Swimburger <[email protected]>
1 parent 11efbd0 commit 01be923

File tree

3,388 files changed

+115578
-2907
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,388 files changed

+115578
-2907
lines changed

api-yml.schema.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,32 @@
370370
],
371371
"additionalProperties": false
372372
},
373+
"auth.EndpointSecuritySchemaDetails": {
374+
"type": "object",
375+
"additionalProperties": false
376+
},
377+
"auth.EndpointSecuritySchema": {
378+
"type": "object",
379+
"properties": {
380+
"docs": {
381+
"oneOf": [
382+
{
383+
"type": "string"
384+
},
385+
{
386+
"type": "null"
387+
}
388+
]
389+
},
390+
"endpoint-security": {
391+
"$ref": "#/definitions/auth.EndpointSecuritySchemaDetails"
392+
}
393+
},
394+
"required": [
395+
"endpoint-security"
396+
],
397+
"additionalProperties": false
398+
},
373399
"auth.ApiAuthSchema": {
374400
"anyOf": [
375401
{
@@ -380,6 +406,9 @@
380406
},
381407
{
382408
"$ref": "#/definitions/auth.AnyAuthSchemesSchema"
409+
},
410+
{
411+
"$ref": "#/definitions/auth.EndpointSecuritySchema"
383412
}
384413
]
385414
},

fern/apis/fern-definition/definition/auth.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ types:
1616
- string
1717
- AuthSchemeReferenceSchema
1818
- AnyAuthSchemesSchema
19+
- EndpointSecuritySchema
1920

2021
AuthSchemeReferenceSchema:
2122
extends:
@@ -29,6 +30,17 @@ types:
2930
properties:
3031
any: list<AnyAuthItem>
3132

33+
EndpointSecuritySchema:
34+
extends:
35+
- commons.WithDocsSchema
36+
properties:
37+
endpoint-security:
38+
type: EndpointSecuritySchemaDetails
39+
docs: Indicates that authentication requirements are defined per-endpoint via the `security` field.
40+
41+
EndpointSecuritySchemaDetails:
42+
properties: {}
43+
3244
AnyAuthItem:
3345
discriminated: false
3446
union:

generators-yml.schema.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,32 @@
15181518
],
15191519
"additionalProperties": false
15201520
},
1521+
"fernDefinition.auth.EndpointSecuritySchemaDetails": {
1522+
"type": "object",
1523+
"additionalProperties": false
1524+
},
1525+
"fernDefinition.auth.EndpointSecuritySchema": {
1526+
"type": "object",
1527+
"properties": {
1528+
"docs": {
1529+
"oneOf": [
1530+
{
1531+
"type": "string"
1532+
},
1533+
{
1534+
"type": "null"
1535+
}
1536+
]
1537+
},
1538+
"endpoint-security": {
1539+
"$ref": "#/definitions/fernDefinition.auth.EndpointSecuritySchemaDetails"
1540+
}
1541+
},
1542+
"required": [
1543+
"endpoint-security"
1544+
],
1545+
"additionalProperties": false
1546+
},
15211547
"fernDefinition.auth.ApiAuthSchema": {
15221548
"anyOf": [
15231549
{
@@ -1528,6 +1554,9 @@
15281554
},
15291555
{
15301556
"$ref": "#/definitions/fernDefinition.auth.AnyAuthSchemesSchema"
1557+
},
1558+
{
1559+
"$ref": "#/definitions/fernDefinition.auth.EndpointSecuritySchema"
15311560
}
15321561
]
15331562
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// service_auth
2+
"/token"
3+
4+
// service_user
5+
"/users"
6+
"/users"
7+
"/users"
8+
"/users"
9+
"/users"

packages/cli/cli/src/commands/export/security.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export function constructEndpointSecurity(apiAuth: ApiAuth): OpenAPIV3.SecurityR
1818
apiAuth.schemes.map((scheme) => ({
1919
[getNameForAuthScheme(scheme)]: []
2020
})),
21+
endpointSecurity: () => {
22+
// When auth is endpoint-security, security is defined per-endpoint, not globally
23+
return [];
24+
},
2125
_other: () => {
2226
throw new Error("Unknown auth scheme requirement: " + apiAuth.requirement);
2327
}

packages/cli/cli/versions.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
# yaml-language-server: $schema=../../../fern-versions-yml.schema.json
2+
- version: 3.27.0
3+
changelogEntry:
4+
- summary: |
5+
Add `ENDPOINT_SECURITY` value to `AuthSchemesRequirement` enum in the IR.
6+
This allows users to specify that authentication requirements are defined per-endpoint rather than globally.
7+
Users can now use `endpoint-security: {}` in their Fern API definition's `auth` field to indicate that security is configured on individual endpoints via the `security` field.
8+
type: feat
9+
createdAt: "2025-12-18"
10+
irVersion: 62
11+
212
- version: 3.26.3
313
changelogEntry:
414
- summary: |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"access_token": {
5+
"type": "string"
6+
},
7+
"expires_in": {
8+
"type": "integer"
9+
},
10+
"refresh_token": {
11+
"oneOf": [
12+
{
13+
"type": "string"
14+
},
15+
{
16+
"type": "null"
17+
}
18+
]
19+
}
20+
},
21+
"required": [
22+
"access_token",
23+
"expires_in"
24+
],
25+
"additionalProperties": false,
26+
"definitions": {}
27+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"id": {
5+
"type": "string"
6+
},
7+
"name": {
8+
"type": "string"
9+
}
10+
},
11+
"required": [
12+
"id",
13+
"name"
14+
],
15+
"additionalProperties": false,
16+
"definitions": {}
17+
}

packages/cli/fern-definition/schema/src/schemas/api/resources/auth/types/ApiAuthSchema.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44

55
import * as FernDefinition from "../../../index";
66

7-
export type ApiAuthSchema = string | FernDefinition.AuthSchemeReferenceSchema | FernDefinition.AnyAuthSchemesSchema;
7+
export type ApiAuthSchema =
8+
| string
9+
| FernDefinition.AuthSchemeReferenceSchema
10+
| FernDefinition.AnyAuthSchemesSchema
11+
| FernDefinition.EndpointSecuritySchema;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
import * as FernDefinition from "../../../index";
6+
7+
export interface EndpointSecuritySchema extends FernDefinition.WithDocsSchema {
8+
/** Indicates that authentication requirements are defined per-endpoint via the `security` field. */
9+
"endpoint-security": FernDefinition.EndpointSecuritySchemaDetails;
10+
}

0 commit comments

Comments
 (0)