Skip to content

Commit 82609c3

Browse files
authored
chore(docs): Add policy to OpenAPI client section (#143)
Fixes a bug where policy endpoints are missing from OpenAPI clients. Also, fixes a bug where `preprocessOpenApiSpecs` was run at ["import-time"](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#:~:text=imported%20module%27s%20side%20effects%20are%20produced%20before%20the%20rest%20of%20the%20module%27s%20code%20starts%20running) of `preprocessing.ts` leading to unexpected state.
1 parent 79162c6 commit 82609c3

17 files changed

+2357
-112
lines changed

docusaurus.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ import type { Config } from "@docusaurus/types";
99
import type * as Preset from "@docusaurus/preset-classic";
1010
import matter from "gray-matter";
1111
import listRemote from "./docusaurus-lib-list-remote";
12-
import { openApiSpecs } from "./preprocessing";
12+
import { preprocessOpenApiSpecs, openApiSpecs } from './src/openapi/preprocessing';
1313
import languageTabs from "./openapi-generated-clients";
1414
import { getSpecDocumentationPlugins } from './src/utils/spec-documentation';
1515

16+
// Execute the preprocessing function for OpenAPI specs
17+
preprocessOpenApiSpecs().catch(error => {
18+
console.error('Failed to preprocess OpenAPI specs:', error);
19+
process.exit(1);
20+
});
21+
1622
const otdfctl = listRemote.createRepo("opentdf", "otdfctl", "main");
1723

1824
const config: Config = {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"write-heading-ids": "docusaurus write-heading-ids",
1515
"gen-api-docs-all": "docusaurus gen-api-docs all --all-versions",
1616
"gen-api-docs-clean": "docusaurus clean-api-docs all",
17-
"check-vendored-yaml": "tsx scripts/check-vendored-yaml.ts",
18-
"update-vendored-yaml": "tsx scripts/update-vendored-yaml.ts"
17+
"check-vendored-yaml": "tsx src/openapi/check-vendored-yaml.ts",
18+
"update-vendored-yaml": "tsx src/openapi/update-vendored-yaml.ts"
1919
},
2020
"dependencies": {
2121
"@docusaurus/core": "^3.6.3",

specs/policy/actions/actions.openapi.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,14 @@ components:
309309
Wrapper message for `bool`.
310310
311311
The JSON representation for `BoolValue` is JSON `true` and `false`.
312+
313+
Not recommended for use in new APIs, but still useful for legacy APIs and
314+
has no plan to be removed.
312315
google.protobuf.Timestamp:
313316
type: string
317+
examples:
318+
- 1s
319+
- 1.000340012s
314320
format: date-time
315321
description: |-
316322
A Timestamp represents a point in time independent of any time zone or local
@@ -463,7 +469,7 @@ components:
463469
items:
464470
$ref: '#/components/schemas/policy.KeyAccessServer'
465471
title: grants
466-
description: Deprecated
472+
description: Deprecated KAS grants for the attribute. Use kas_keys instead.
467473
fqn:
468474
type: string
469475
title: fqn
@@ -650,7 +656,7 @@ components:
650656
items:
651657
$ref: '#/components/schemas/policy.KeyAccessServer'
652658
title: grants
653-
description: KAS grants for the namespace
659+
description: Deprecated KAS grants for the namespace. Use kas_keys instead.
654660
kasKeys:
655661
type: array
656662
items:
@@ -897,9 +903,7 @@ components:
897903
items:
898904
$ref: '#/components/schemas/policy.KeyAccessServer'
899905
title: grants
900-
description: |-
901-
Deprecated
902-
list of key access servers
906+
description: Deprecated KAS grants for the value. Use kas_keys instead.
903907
fqn:
904908
type: string
905909
title: fqn

specs/policy/attributes/attributes.openapi.yaml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ paths:
137137
Fully Qualified Names of attribute values (i.e. https://<namespace>/attr/<attribute_name>/value/<value_name>), normalized to lower case.
138138
- name: withValue.withKeyAccessGrants
139139
in: query
140+
description: Deprecated
140141
schema:
141142
type: boolean
142143
title: with_key_access_grants
144+
description: Deprecated
143145
- name: withValue.withSubjectMaps
144146
in: query
145147
schema:
@@ -152,9 +154,11 @@ paths:
152154
title: with_resource_maps
153155
- name: withValue.withAttribute.withKeyAccessGrants
154156
in: query
157+
description: Deprecated
155158
schema:
156159
type: boolean
157160
title: with_key_access_grants
161+
description: Deprecated
158162
responses:
159163
default:
160164
description: Error
@@ -456,6 +460,7 @@ paths:
456460
application/json:
457461
schema:
458462
$ref: '#/components/schemas/policy.attributes.AssignKeyAccessServerToAttributeResponse'
463+
deprecated: true
459464
/policy.attributes.AttributesService/RemoveKeyAccessServerFromAttribute:
460465
post:
461466
tags:
@@ -491,6 +496,7 @@ paths:
491496
application/json:
492497
schema:
493498
$ref: '#/components/schemas/policy.attributes.RemoveKeyAccessServerFromAttributeResponse'
499+
deprecated: true
494500
/policy.attributes.AttributesService/AssignKeyAccessServerToValue:
495501
post:
496502
tags:
@@ -526,6 +532,7 @@ paths:
526532
application/json:
527533
schema:
528534
$ref: '#/components/schemas/policy.attributes.AssignKeyAccessServerToValueResponse'
535+
deprecated: true
529536
/policy.attributes.AttributesService/RemoveKeyAccessServerFromValue:
530537
post:
531538
tags:
@@ -561,6 +568,7 @@ paths:
561568
application/json:
562569
schema:
563570
$ref: '#/components/schemas/policy.attributes.RemoveKeyAccessServerFromValueResponse'
571+
deprecated: true
564572
/policy.attributes.AttributesService/AssignPublicKeyToAttribute:
565573
post:
566574
tags:
@@ -842,8 +850,14 @@ components:
842850
Wrapper message for `bool`.
843851
844852
The JSON representation for `BoolValue` is JSON `true` and `false`.
853+
854+
Not recommended for use in new APIs, but still useful for legacy APIs and
855+
has no plan to be removed.
845856
google.protobuf.Timestamp:
846857
type: string
858+
examples:
859+
- 1s
860+
- 1.000340012s
847861
format: date-time
848862
description: |-
849863
A Timestamp represents a point in time independent of any time zone or local
@@ -996,7 +1010,7 @@ components:
9961010
items:
9971011
$ref: '#/components/schemas/policy.KeyAccessServer'
9981012
title: grants
999-
description: Deprecated
1013+
description: Deprecated KAS grants for the attribute. Use kas_keys instead.
10001014
fqn:
10011015
type: string
10021016
title: fqn
@@ -1024,6 +1038,7 @@ components:
10241038
withKeyAccessGrants:
10251039
type: boolean
10261040
title: with_key_access_grants
1041+
description: Deprecated
10271042
withSubjectMaps:
10281043
type: boolean
10291044
title: with_subject_maps
@@ -1041,6 +1056,7 @@ components:
10411056
withKeyAccessGrants:
10421057
type: boolean
10431058
title: with_key_access_grants
1059+
description: Deprecated
10441060
withNamespace:
10451061
title: with_namespace
10461062
$ref: '#/components/schemas/policy.AttributeValueSelector.AttributeSelector.NamespaceSelector'
@@ -1215,7 +1231,7 @@ components:
12151231
items:
12161232
$ref: '#/components/schemas/policy.KeyAccessServer'
12171233
title: grants
1218-
description: KAS grants for the namespace
1234+
description: Deprecated KAS grants for the namespace. Use kas_keys instead.
12191235
kasKeys:
12201236
type: array
12211237
items:
@@ -1462,9 +1478,7 @@ components:
14621478
items:
14631479
$ref: '#/components/schemas/policy.KeyAccessServer'
14641480
title: grants
1465-
description: |-
1466-
Deprecated
1467-
list of key access servers
1481+
description: Deprecated KAS grants for the value. Use kas_keys instead.
14681482
fqn:
14691483
type: string
14701484
title: fqn
@@ -1601,6 +1615,7 @@ components:
16011615
description: Required
16021616
title: AttributeKeyAccessServer
16031617
additionalProperties: false
1618+
description: Deprecated
16041619
policy.attributes.CreateAttributeRequest:
16051620
type: object
16061621
properties:
@@ -1633,7 +1648,10 @@ components:
16331648
uniqueItems: true
16341649
title: values
16351650
uniqueItems: true
1636-
description: "Optional \n Attribute values (when provided) must be alphanumeric strings, allowing hyphens and underscores but not as the first or last character.\n The stored attribute value will be normalized to lower case."
1651+
description: |-
1652+
Optional
1653+
Attribute values (when provided) must be alphanumeric strings, allowing hyphens and underscores but not as the first or last character.
1654+
The stored attribute value will be normalized to lower case.
16371655
metadata:
16381656
title: metadata
16391657
description: Optional

0 commit comments

Comments
 (0)