From 26470ffecaedfbe0f5ac620b645b1ac1ad4ab926 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Fri, 4 Oct 2024 16:44:25 +0200 Subject: [PATCH 01/39] Add report middleware to handle report layout --- src/layouts/report.hbs | 0 src/lib/index.ts | 1 + src/lib/report.ts | 224 +++++++++++++++++++++++++++++++++++++++++ src/metalsmith.ts | 10 +- 4 files changed, 234 insertions(+), 1 deletion(-) create mode 100644 src/layouts/report.hbs create mode 100644 src/lib/report.ts diff --git a/src/layouts/report.hbs b/src/layouts/report.hbs new file mode 100644 index 00000000..e69de29b diff --git a/src/lib/index.ts b/src/lib/index.ts index b79f4212..8d0e07a9 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -2,3 +2,4 @@ export * from './blueprint.js' export * as helpers from './handlebars-helpers.js' export * from './postprocess.js' export * from './reference.js' +export * from './report.js' diff --git a/src/lib/report.ts b/src/lib/report.ts new file mode 100644 index 00000000..8895bba5 --- /dev/null +++ b/src/lib/report.ts @@ -0,0 +1,224 @@ +import type { + Blueprint, + Endpoint, + Parameter, + Property, + Resource, + Route, +} from '@seamapi/blueprint' +import type Metalsmith from 'metalsmith' + +type Metadata = Partial> + +interface ReportItem { + name: string + reason?: string +} + +interface ParameterReportItem { + path: string + params: ReportItem[] +} + +interface ReportSection { + resourceProperties: ReportItem[] + endpoints: ReportItem[] + parameters: ParameterReportItem[] +} + +interface Report { + undocumented: ReportSection + noDescription: ReportSection & { resources: string[] } + draft: Omit & { + resourceProperties: string[] + } + missingReturnType: string[] + deprecated: ReportSection +} + +export const report = ( + files: Metalsmith.Files, + metalsmith: Metalsmith, +): void => { + const metadata = { + title: '', + routes: [], + resources: {}, + ...(metalsmith.metadata() as Metadata), + } + + const reportData = generateReport(metadata) + + files['api/_report.md'] = { + contents: Buffer.from('\n'), + layout: 'report.hbs', + ...reportData, + } +} + +function generateReport(metadata: Metadata): Report { + const report: Report = { + undocumented: createEmptyReportSection(), + noDescription: { ...createEmptyReportSection(), resources: [] }, + draft: { ...createEmptyReportSection(), resourceProperties: [] }, + missingReturnType: [], + deprecated: createEmptyReportSection(), + } + + const resources = metadata.resources ?? {}; + for (const [resourceName, resource] of Object.entries(resources)) { + processResource(resourceName, resource, report); + } + + const routes = metadata.routes ?? []; + for (const route of routes) { + processRoute(route, report); + } + + return report +} + +function createEmptyReportSection(): ReportSection { + return { + resourceProperties: [], + endpoints: [], + parameters: [], + } +} + +function processResource( + resourceName: string, + resource: Resource, + report: Report, +): void { + if (resource.description == null || resource.description.trim() === '') { + report.noDescription.resources.push(resourceName) + } + + for (const property of resource.properties) { + processProperty(resourceName, property, report); + } +} + +function processProperty( + resourceName: string, + property: Property, + report: Report, +): void { + const propertyName = `${resourceName}.${property.name}` + if (property.isUndocumented) { + report.undocumented.resourceProperties.push({ + name: propertyName, + reason: 'Intentionally undocumented', + }) + } else if ( + property.description == null || + property.description.trim() === '' + ) { + report.noDescription.resourceProperties.push({ name: propertyName }) + } + if (property.isDeprecated) { + report.deprecated.resourceProperties.push({ + name: propertyName, + reason: property.deprecationMessage ?? 'No reason provided', + }) + } +} + +function processRoute(route: Route, report: Report): void { + if (route.isUndocumented) { + report.undocumented.endpoints.push({ + name: route.path, + reason: 'Intentionally undocumented', + }) + } + + if (route.isDeprecated) { + report.deprecated.endpoints.push({ + name: route.path, + reason: 'No reason provided', + }) + } + + for (const endpoint of route.endpoints) { + processEndpoint(endpoint, report); + } +} + +function processEndpoint(endpoint: Endpoint, report: Report): void { + if (endpoint.isUndocumented) { + report.undocumented.endpoints.push({ + name: endpoint.path, + reason: 'Intentionally undocumented', + }) + } else if ( + endpoint.description == null || + endpoint.description.trim() === '' + ) { + report.noDescription.endpoints.push({ name: endpoint.path }) + } + if (endpoint.isDeprecated) { + report.deprecated.endpoints.push({ + name: endpoint.path, + reason: endpoint.deprecationMessage ?? 'No reason provided', + }) + } + if ( + 'responseType' in endpoint.response && + endpoint.response.responseType == null + ) { + report.missingReturnType.push(endpoint.path) + } + + processParameters(endpoint.path, endpoint.request.parameters, report) +} + +function processParameters( + path: string, + parameters: Parameter[], + report: Report, +): void { + const categorizedParams = parameters.reduce( + (acc, param) => { + if (param.isUndocumented) { + acc.undocumented.push({ + name: param.name, + reason: 'Intentionally undocumented', + }) + } else if (param.description == null || param.description.trim() === '') { + acc.noDescription.push(param.name) + } + if (param.isDeprecated) { + acc.deprecated.push({ + name: param.name, + reason: param.deprecationMessage ?? 'No reason provided', + }) + } + return acc + }, + { + undocumented: [] as ReportItem[], + noDescription: [] as string[], + deprecated: [] as ReportItem[], + }, + ) + + if (categorizedParams.undocumented.length > 0) { + report.undocumented.parameters.push({ + path, + params: categorizedParams.undocumented, + }) + } + if (categorizedParams.noDescription.length > 0) { + report.noDescription.parameters.push({ + path, + params: categorizedParams.noDescription.map((name) => ({ name })), + }) + } + if (categorizedParams.deprecated.length > 0) { + report.deprecated.parameters.push({ + path, + params: categorizedParams.deprecated, + }) + } +} diff --git a/src/metalsmith.ts b/src/metalsmith.ts index da14831a..3fb8b610 100644 --- a/src/metalsmith.ts +++ b/src/metalsmith.ts @@ -6,7 +6,13 @@ import metadata from '@metalsmith/metadata' import { deleteAsync } from 'del' import Metalsmith from 'metalsmith' -import { blueprint, helpers, postprocess, reference } from './lib/index.js' +import { + blueprint, + helpers, + postprocess, + reference, + report, +} from './lib/index.js' const rootDir = dirname(fileURLToPath(import.meta.url)) @@ -23,9 +29,11 @@ Metalsmith(rootDir) ) .use(blueprint) .use(reference) + .use(report) .use( layouts({ default: 'default.hbs', + pattern: '**/*.md', engineOptions: { noEscape: true, helpers, From b20849d865e673edbf459718c8ed0a90594bd689 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Fri, 4 Oct 2024 16:44:37 +0200 Subject: [PATCH 02/39] Add layout --- src/layouts/report.hbs | 122 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/src/layouts/report.hbs b/src/layouts/report.hbs index e69de29b..48607537 100644 --- a/src/layouts/report.hbs +++ b/src/layouts/report.hbs @@ -0,0 +1,122 @@ +# Reference Documentation Report + +## Undocumented + +These items are intentionally undocumented. + +### Resource properties + +{{#each undocumented.resourceProperties}} +- `{{name}}`: {{reason}} +{{/each}} + +### Endpoints + +{{#each undocumented.endpoints}} +- `{{path}}`: {{reason}} +{{/each}} + +### Endpoint parameters + +{{#each undocumented.parameters}} +- `{{path}}` + {{#each params}} + - `{{name}}`: {{reason}} + {{/each}} +{{/each}} + +## No Description + +These items have an empty description. +Items that are intentionally undocumented are not included in this section. + +### Resources + +{{#each noDescription.resources}} +- `{{this}}` +{{/each}} + +### Resource properties + +{{#each noDescription.properties}} +- `{{this}}` +{{/each}} + +### Endpoints + +{{#each noDescription.endpoints}} +- `{{this}}` +{{/each}} + +### Endpoint parameters + +{{#each noDescription.parameters}} +- `{{path}}` + {{#each params}} + - `{{name}}` + {{/each}} +{{/each}} + +## Draft + +These items have been marked as draft. + +### Resources + +{{#each draft.resources}} +- `{{this}}` +{{/each}} + +### Resource properties + +{{#each draft.properties}} +- `{{this}}` +{{/each}} + +### Endpoints + +{{#each draft.endpoints}} +- `{{this}}` +{{/each}} + +### Endpoint parameters + +{{#each draft.parameters}} +- `{{path}}` + {{#each params}} + - `{{this}}` + {{/each}} +{{/each}} + +## Missing `return_type` + +These routes are missing a `return_type` and should be fixed. + +{{#each missingReturnType}} +- `{{this}}` +{{/each}} + +## Deprecated + +These items are deprecated. + +### Resource properties + +{{#each deprecated.resourceProperties}} +- `{{name}}`: {{reason}} +{{/each}} + +### Endpoints + +{{#each deprecated.endpoints}} +- `{{name}}`: {{reason}} +{{/each}} + +### Endpoint parameters + +{{#each deprecated.parameters}} +- `{{path}}` + {{#each params}} + - `{{name}}`: {{reason}} + {{/each}} +{{/each}} From a182e50556627dd7fa64c9dbe8ece4c702d7d909 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Fri, 4 Oct 2024 14:45:14 +0000 Subject: [PATCH 03/39] ci: Format code --- src/lib/report.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/report.ts b/src/lib/report.ts index 8895bba5..30d4af5c 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -65,14 +65,14 @@ function generateReport(metadata: Metadata): Report { deprecated: createEmptyReportSection(), } - const resources = metadata.resources ?? {}; + const resources = metadata.resources ?? {} for (const [resourceName, resource] of Object.entries(resources)) { - processResource(resourceName, resource, report); + processResource(resourceName, resource, report) } - const routes = metadata.routes ?? []; + const routes = metadata.routes ?? [] for (const route of routes) { - processRoute(route, report); + processRoute(route, report) } return report @@ -96,7 +96,7 @@ function processResource( } for (const property of resource.properties) { - processProperty(resourceName, property, report); + processProperty(resourceName, property, report) } } @@ -141,7 +141,7 @@ function processRoute(route: Route, report: Report): void { } for (const endpoint of route.endpoints) { - processEndpoint(endpoint, report); + processEndpoint(endpoint, report) } } From cbb75f92442e9460392f5af40e1aebacbb1877b6 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Fri, 4 Oct 2024 14:46:02 +0000 Subject: [PATCH 04/39] ci: Generate docs --- docs/api/_report.md | 368 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 368 insertions(+) create mode 100644 docs/api/_report.md diff --git a/docs/api/_report.md b/docs/api/_report.md new file mode 100644 index 00000000..8e1c7f4a --- /dev/null +++ b/docs/api/_report.md @@ -0,0 +1,368 @@ +# Reference Documentation Report + +## Undocumented + +These items are intentionally undocumented. + +### Resource properties + +- `acs_user.is_latest_desired_state_synced_with_provider`: Intentionally undocumented +- `acs_user.latest_desired_state_synced_with_provider_at`: Intentionally undocumented + +### Endpoints + +- ``: Intentionally undocumented +- ``: Intentionally undocumented +- ``: Intentionally undocumented +- ``: Intentionally undocumented +- ``: Intentionally undocumented + +### Endpoint parameters + + +## No Description + +These items have an empty description. +Items that are intentionally undocumented are not included in this section. + +### Resources + +- `acs_access_group` +- `acs_credential` +- `acs_credential_pool` +- `acs_credential_provisioning_automation` +- `acs_entrance` +- `acs_user` +- `event` +- `thermostat_schedule` + +### Resource properties + + +### Endpoints + +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` +- `[object Object]` + +### Endpoint parameters + +- `/acs/access_groups/add_user` + - `acs_access_group_id` + - `acs_user_id` +- `/acs/access_groups/add_user` + - `acs_access_group_id` + - `acs_user_id` +- `/acs/access_groups/get` + - `acs_access_group_id` +- `/acs/access_groups/list` + - `acs_system_id` + - `acs_user_id` +- `/acs/access_groups/list_accessible_entrances` + - `acs_access_group_id` +- `/acs/access_groups/list_users` + - `acs_access_group_id` +- `/acs/access_groups/remove_user` + - `acs_access_group_id` + - `acs_user_id` +- `/acs/access_groups/unmanaged/get` + - `acs_access_group_id` +- `/acs/access_groups/unmanaged/list` + - `acs_system_id` + - `acs_user_id` +- `/acs/credential_pools/list` + - `acs_system_id` +- `/acs/credential_provisioning_automations/launch` + - `acs_credential_pool_id` + - `create_credential_manager_user` + - `credential_manager_acs_system_id` + - `credential_manager_acs_user_id` + - `user_identity_id` +- `/acs/credentials/assign` + - `acs_credential_id` + - `acs_user_id` +- `/acs/credentials/assign` + - `acs_credential_id` + - `acs_user_id` +- `/acs/credentials/create` + - `access_method` + - `acs_user_id` + - `allowed_acs_entrance_ids` + - `code` + - `credential_manager_acs_system_id` + - `ends_at` + - `is_multi_phone_sync_credential` + - `starts_at` + - `visionline_metadata` +- `/acs/credentials/delete` + - `acs_credential_id` +- `/acs/credentials/get` + - `acs_credential_id` +- `/acs/credentials/list_accessible_entrances` + - `acs_credential_id` +- `/acs/credentials/unassign` + - `acs_credential_id` + - `acs_user_id` +- `/acs/credentials/unassign` + - `acs_credential_id` + - `acs_user_id` +- `/acs/credentials/update` + - `acs_credential_id` + - `code` + - `ends_at` +- `/acs/credentials/update` + - `acs_credential_id` + - `code` + - `ends_at` +- `/acs/credentials/unmanaged/get` + - `acs_credential_id` +- `/acs/entrances/get` + - `acs_entrance_id` +- `/acs/entrances/grant_access` + - `acs_entrance_id` + - `acs_user_id` +- `/acs/entrances/list` + - `acs_credential_id` + - `acs_system_id` +- `/acs/entrances/list_credentials_with_access` + - `acs_entrance_id` + - `include_if` +- `/acs/users/create` + - `email` +- `/acs/users/list` + - `created_before` + - `limit` +- `/acs/users/update` + - `email` + - `hid_acs_system_id` +- `/acs/users/update` + - `email` + - `hid_acs_system_id` +- `/acs/users/unmanaged/get` + - `acs_user_id` +- `/acs/users/unmanaged/list` + - `acs_system_id` + - `limit` + - `user_identity_email_address` + - `user_identity_id` + - `user_identity_phone_number` +- `/events/get` + - `device_id` + - `event_id` + - `event_type` +- `/events/list` + - `access_code_id` + - `access_code_ids` + - `between` + - `connect_webview_id` + - `connected_account_id` + - `device_id` + - `device_ids` + - `event_type` + - `event_types` + - `limit` + - `since` +- `/thermostats/activate_climate_preset` + - `climate_preset_key` + - `device_id` +- `/thermostats/cool` + - `cooling_set_point_celsius` + - `cooling_set_point_fahrenheit` + - `device_id` + - `sync` +- `/thermostats/create_climate_preset` + - `climate_preset_key` + - `cooling_set_point_celsius` + - `cooling_set_point_fahrenheit` + - `device_id` + - `fan_mode_setting` + - `heating_set_point_celsius` + - `heating_set_point_fahrenheit` + - `hvac_mode_setting` + - `manual_override_allowed` + - `name` +- `/thermostats/delete_climate_preset` + - `climate_preset_key` + - `device_id` +- `/thermostats/get` + - `device_id` + - `name` +- `/thermostats/heat` + - `device_id` + - `heating_set_point_celsius` + - `heating_set_point_fahrenheit` + - `sync` +- `/thermostats/heat_cool` + - `cooling_set_point_celsius` + - `cooling_set_point_fahrenheit` + - `device_id` + - `heating_set_point_celsius` + - `heating_set_point_fahrenheit` + - `sync` +- `/thermostats/list` + - `connect_webview_id` + - `connected_account_ids` + - `created_before` + - `custom_metadata_has` + - `device_ids` + - `device_types` + - `exclude_if` + - `include_if` + - `limit` + - `manufacturer` + - `user_identifier_key` +- `/thermostats/off` + - `device_id` + - `sync` +- `/thermostats/set_fallback_climate_preset` + - `climate_preset_key` + - `device_id` +- `/thermostats/set_fan_mode` + - `device_id` + - `fan_mode` + - `fan_mode_setting` + - `sync` +- `/thermostats/update_climate_preset` + - `climate_preset_key` + - `cooling_set_point_celsius` + - `cooling_set_point_fahrenheit` + - `device_id` + - `fan_mode_setting` + - `heating_set_point_celsius` + - `heating_set_point_fahrenheit` + - `hvac_mode_setting` + - `manual_override_allowed` + - `name` +- `/thermostats/update_climate_preset` + - `climate_preset_key` + - `cooling_set_point_celsius` + - `cooling_set_point_fahrenheit` + - `device_id` + - `fan_mode_setting` + - `heating_set_point_celsius` + - `heating_set_point_fahrenheit` + - `hvac_mode_setting` + - `manual_override_allowed` + - `name` +- `/thermostats/schedules/create` + - `climate_preset_key` + - `device_id` + - `ends_at` + - `max_override_period_minutes` + - `name` + - `starts_at` +- `/thermostats/schedules/delete` + - `thermostat_schedule_id` +- `/thermostats/schedules/get` + - `thermostat_schedule_id` +- `/thermostats/schedules/list` + - `device_id` + - `user_identifier_key` +- `/thermostats/schedules/update` + - `climate_preset_key` + - `ends_at` + - `max_override_period_minutes` + - `name` + - `starts_at` + - `thermostat_schedule_id` +- `/thermostats/schedules/update` + - `climate_preset_key` + - `ends_at` + - `max_override_period_minutes` + - `name` + - `starts_at` + - `thermostat_schedule_id` + +## Draft + +These items have been marked as draft. + +### Resources + + +### Resource properties + + +### Endpoints + + +### Endpoint parameters + + +## Missing `return_type` + +These routes are missing a `return_type` and should be fixed. + + +## Deprecated + +These items are deprecated. + +### Resource properties + +- `acs_access_group.access_group_type`: use external_type +- `acs_access_group.access_group_type_display_name`: use external_type_display_name +- `acs_system.system_type`: Use `external_type`. +- `acs_system.system_type_display_name`: Use `external_type_display_name`. +- `acs_user.email`: use email_address. + +### Endpoints + + +### Endpoint parameters + +- `/acs/users/create` + - `email`: use email_address. +- `/acs/users/update` + - `email`: use email_address. +- `/acs/users/update` + - `email`: use email_address. +- `/thermostats/set_fan_mode` + - `fan_mode`: use fan_mode_setting instead. From d5f42d1d6a177cb358f75bad0c8ecd55fa004a0e Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Fri, 4 Oct 2024 16:48:31 +0200 Subject: [PATCH 05/39] Fix layout --- src/layouts/report.hbs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/layouts/report.hbs b/src/layouts/report.hbs index 48607537..c2f3cecf 100644 --- a/src/layouts/report.hbs +++ b/src/layouts/report.hbs @@ -13,7 +13,7 @@ These items are intentionally undocumented. ### Endpoints {{#each undocumented.endpoints}} -- `{{path}}`: {{reason}} +- `{{name}}`: {{reason}} {{/each}} ### Endpoint parameters @@ -33,19 +33,19 @@ Items that are intentionally undocumented are not included in this section. ### Resources {{#each noDescription.resources}} -- `{{this}}` +- `{{name}}` {{/each}} ### Resource properties {{#each noDescription.properties}} -- `{{this}}` +- `{{name}}` {{/each}} ### Endpoints {{#each noDescription.endpoints}} -- `{{this}}` +- `{{name}}` {{/each}} ### Endpoint parameters @@ -64,19 +64,19 @@ These items have been marked as draft. ### Resources {{#each draft.resources}} -- `{{this}}` +- `{{name}}` {{/each}} ### Resource properties {{#each draft.properties}} -- `{{this}}` +- `{{name}}` {{/each}} ### Endpoints {{#each draft.endpoints}} -- `{{this}}` +- `{{name}}` {{/each}} ### Endpoint parameters @@ -84,7 +84,7 @@ These items have been marked as draft. {{#each draft.parameters}} - `{{path}}` {{#each params}} - - `{{this}}` + - `{{name}}` {{/each}} {{/each}} From 0ca9dbebd9a3acf65b01fddfd835b442e3ff4461 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Fri, 4 Oct 2024 14:50:14 +0000 Subject: [PATCH 06/39] ci: Generate docs --- docs/api/_report.md | 126 ++++++++++++++++++++++---------------------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/docs/api/_report.md b/docs/api/_report.md index 8e1c7f4a..49dd7876 100644 --- a/docs/api/_report.md +++ b/docs/api/_report.md @@ -11,11 +11,11 @@ These items are intentionally undocumented. ### Endpoints -- ``: Intentionally undocumented -- ``: Intentionally undocumented -- ``: Intentionally undocumented -- ``: Intentionally undocumented -- ``: Intentionally undocumented +- `/acs/encoders/encode_card`: Intentionally undocumented +- `/acs/encoders/read_card`: Intentionally undocumented +- `/acs/users/unmanaged`: Intentionally undocumented +- `/acs/users/unmanaged/get`: Intentionally undocumented +- `/acs/users/unmanaged/list`: Intentionally undocumented ### Endpoint parameters @@ -27,70 +27,70 @@ Items that are intentionally undocumented are not included in this section. ### Resources -- `acs_access_group` -- `acs_credential` -- `acs_credential_pool` -- `acs_credential_provisioning_automation` -- `acs_entrance` -- `acs_user` -- `event` -- `thermostat_schedule` +- `` +- `` +- `` +- `` +- `` +- `` +- `` +- `` ### Resource properties ### Endpoints -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` -- `[object Object]` +- `/acs/access_groups/add_user` +- `/acs/access_groups/add_user` +- `/acs/access_groups/get` +- `/acs/access_groups/list` +- `/acs/access_groups/list_accessible_entrances` +- `/acs/access_groups/list_users` +- `/acs/access_groups/remove_user` +- `/acs/access_groups/unmanaged/get` +- `/acs/access_groups/unmanaged/list` +- `/acs/credential_pools/list` +- `/acs/credential_provisioning_automations/launch` +- `/acs/credentials/assign` +- `/acs/credentials/assign` +- `/acs/credentials/create` +- `/acs/credentials/delete` +- `/acs/credentials/get` +- `/acs/credentials/list` +- `/acs/credentials/list_accessible_entrances` +- `/acs/credentials/unassign` +- `/acs/credentials/unassign` +- `/acs/credentials/update` +- `/acs/credentials/update` +- `/acs/credentials/unmanaged/get` +- `/acs/credentials/unmanaged/list` +- `/acs/encoders/list` +- `/acs/entrances/get` +- `/acs/entrances/grant_access` +- `/acs/entrances/list` +- `/acs/entrances/list_credentials_with_access` +- `/events/get` +- `/events/list` +- `/thermostats/activate_climate_preset` +- `/thermostats/cool` +- `/thermostats/create_climate_preset` +- `/thermostats/delete_climate_preset` +- `/thermostats/get` +- `/thermostats/heat` +- `/thermostats/heat_cool` +- `/thermostats/list` +- `/thermostats/off` +- `/thermostats/set_fallback_climate_preset` +- `/thermostats/set_fan_mode` +- `/thermostats/update_climate_preset` +- `/thermostats/update_climate_preset` +- `/thermostats/schedules/create` +- `/thermostats/schedules/delete` +- `/thermostats/schedules/get` +- `/thermostats/schedules/list` +- `/thermostats/schedules/update` +- `/thermostats/schedules/update` ### Endpoint parameters From 65644785274bdee66087707193993cc46237d80a Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Fri, 4 Oct 2024 16:52:14 +0200 Subject: [PATCH 07/39] Update draft report type --- src/lib/report.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib/report.ts b/src/lib/report.ts index 30d4af5c..10db1b40 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -29,9 +29,7 @@ interface ReportSection { interface Report { undocumented: ReportSection noDescription: ReportSection & { resources: string[] } - draft: Omit & { - resourceProperties: string[] - } + draft: ReportSection missingReturnType: string[] deprecated: ReportSection } From 21444ff49a7a756d74a7f69e3f3a0b9d31e61847 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Mon, 7 Oct 2024 16:58:10 +0200 Subject: [PATCH 08/39] Remove missing return type section --- src/layouts/report.hbs | 8 -------- src/lib/report.ts | 8 -------- 2 files changed, 16 deletions(-) diff --git a/src/layouts/report.hbs b/src/layouts/report.hbs index c2f3cecf..1b077b17 100644 --- a/src/layouts/report.hbs +++ b/src/layouts/report.hbs @@ -88,14 +88,6 @@ These items have been marked as draft. {{/each}} {{/each}} -## Missing `return_type` - -These routes are missing a `return_type` and should be fixed. - -{{#each missingReturnType}} -- `{{this}}` -{{/each}} - ## Deprecated These items are deprecated. diff --git a/src/lib/report.ts b/src/lib/report.ts index 10db1b40..4a82d7ca 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -30,7 +30,6 @@ interface Report { undocumented: ReportSection noDescription: ReportSection & { resources: string[] } draft: ReportSection - missingReturnType: string[] deprecated: ReportSection } @@ -59,7 +58,6 @@ function generateReport(metadata: Metadata): Report { undocumented: createEmptyReportSection(), noDescription: { ...createEmptyReportSection(), resources: [] }, draft: { ...createEmptyReportSection(), resourceProperties: [] }, - missingReturnType: [], deprecated: createEmptyReportSection(), } @@ -161,12 +159,6 @@ function processEndpoint(endpoint: Endpoint, report: Report): void { reason: endpoint.deprecationMessage ?? 'No reason provided', }) } - if ( - 'responseType' in endpoint.response && - endpoint.response.responseType == null - ) { - report.missingReturnType.push(endpoint.path) - } processParameters(endpoint.path, endpoint.request.parameters, report) } From 6223d81b3ac5474afe0784e9c6f71b6aded0f800 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Mon, 7 Oct 2024 14:58:56 +0000 Subject: [PATCH 09/39] ci: Generate docs --- docs/api/_report.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/api/_report.md b/docs/api/_report.md index 49dd7876..1d9b8d87 100644 --- a/docs/api/_report.md +++ b/docs/api/_report.md @@ -336,11 +336,6 @@ These items have been marked as draft. ### Endpoint parameters -## Missing `return_type` - -These routes are missing a `return_type` and should be fixed. - - ## Deprecated These items are deprecated. From 0f3159208d47352db638b5ed85aa0221ab155052 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Mon, 7 Oct 2024 17:16:35 +0200 Subject: [PATCH 10/39] Add todos --- src/lib/report.ts | 50 +++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/src/lib/report.ts b/src/lib/report.ts index 4a82d7ca..16bf8bbd 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -15,6 +15,8 @@ interface ReportItem { reason?: string } +const defaultReason = 'No reason provided' + interface ParameterReportItem { path: string params: ReportItem[] @@ -90,6 +92,7 @@ function processResource( if (resource.description == null || resource.description.trim() === '') { report.noDescription.resources.push(resourceName) } + // TODO: draft, deprecated, undocumented when supported for (const property of resource.properties) { processProperty(resourceName, property, report) @@ -102,40 +105,45 @@ function processProperty( report: Report, ): void { const propertyName = `${resourceName}.${property.name}` + if (property.isUndocumented) { report.undocumented.resourceProperties.push({ name: propertyName, - reason: 'Intentionally undocumented', + reason: 'Intentionally undocumented', // TODO: undocumentedMessage }) - } else if ( - property.description == null || - property.description.trim() === '' - ) { + } + + if (property.description == null || property.description.trim() === '') { report.noDescription.resourceProperties.push({ name: propertyName }) } + if (property.isDeprecated) { report.deprecated.resourceProperties.push({ name: propertyName, - reason: property.deprecationMessage ?? 'No reason provided', + reason: property.deprecationMessage ?? defaultReason, }) } + + // TODO: draft } function processRoute(route: Route, report: Report): void { if (route.isUndocumented) { report.undocumented.endpoints.push({ name: route.path, - reason: 'Intentionally undocumented', + reason: 'Intentionally undocumented', // TODO: undocumentedMessage }) } if (route.isDeprecated) { report.deprecated.endpoints.push({ name: route.path, - reason: 'No reason provided', + reason: defaultReason, // TODO: deprecationMessage }) } + // TODO: draft, description + for (const endpoint of route.endpoints) { processEndpoint(endpoint, report) } @@ -145,21 +153,23 @@ function processEndpoint(endpoint: Endpoint, report: Report): void { if (endpoint.isUndocumented) { report.undocumented.endpoints.push({ name: endpoint.path, - reason: 'Intentionally undocumented', + reason: 'Intentionally undocumented', // TODO: undocumentedMessage }) - } else if ( - endpoint.description == null || - endpoint.description.trim() === '' - ) { + } + + if (endpoint.description == null || endpoint.description.trim() === '') { report.noDescription.endpoints.push({ name: endpoint.path }) } + if (endpoint.isDeprecated) { report.deprecated.endpoints.push({ name: endpoint.path, - reason: endpoint.deprecationMessage ?? 'No reason provided', + reason: endpoint.deprecationMessage ?? defaultReason, }) } + // TODO: draft + processParameters(endpoint.path, endpoint.request.parameters, report) } @@ -173,17 +183,23 @@ function processParameters( if (param.isUndocumented) { acc.undocumented.push({ name: param.name, - reason: 'Intentionally undocumented', + reason: 'Intentionally undocumented', // TODO: undocumentedMessage }) - } else if (param.description == null || param.description.trim() === '') { + } + + if (param.description == null || param.description.trim() === '') { acc.noDescription.push(param.name) } + if (param.isDeprecated) { acc.deprecated.push({ name: param.name, - reason: param.deprecationMessage ?? 'No reason provided', + reason: param.deprecationMessage ?? defaultReason, }) } + + // TODO: draft + return acc }, { From 92910c679337516a84c233f725c45aabd5e32eb1 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Mon, 7 Oct 2024 15:17:25 +0000 Subject: [PATCH 11/39] ci: Generate docs --- docs/api/_report.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/api/_report.md b/docs/api/_report.md index 1d9b8d87..f23b30fb 100644 --- a/docs/api/_report.md +++ b/docs/api/_report.md @@ -65,11 +65,15 @@ Items that are intentionally undocumented are not included in this section. - `/acs/credentials/update` - `/acs/credentials/unmanaged/get` - `/acs/credentials/unmanaged/list` +- `/acs/encoders/encode_card` - `/acs/encoders/list` +- `/acs/encoders/read_card` - `/acs/entrances/get` - `/acs/entrances/grant_access` - `/acs/entrances/list` - `/acs/entrances/list_credentials_with_access` +- `/acs/users/unmanaged/get` +- `/acs/users/unmanaged/list` - `/events/get` - `/events/list` - `/thermostats/activate_climate_preset` From ca6e8c9e9445485309c8b6fda6900b1192d1c869 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Mon, 7 Oct 2024 18:13:31 +0200 Subject: [PATCH 12/39] Add or helper to avoid rendering empty sections, fix resources without desc --- src/layouts/report.hbs | 8 ++++++++ src/lib/handlebars-helpers.ts | 7 +++++++ src/lib/report.ts | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/layouts/report.hbs b/src/layouts/report.hbs index 1b077b17..d1d54003 100644 --- a/src/layouts/report.hbs +++ b/src/layouts/report.hbs @@ -1,4 +1,5 @@ # Reference Documentation Report +{{#if (or undocumented.resourceProperties.length undocumented.endpoints.length undocumented.parameters.length)}} ## Undocumented @@ -24,6 +25,8 @@ These items are intentionally undocumented. - `{{name}}`: {{reason}} {{/each}} {{/each}} +{{/if}} +{{#if (or noDescription.resources.length noDescription.properties.length noDescription.endpoints.length noDescription.parameters.length)}} ## No Description @@ -56,6 +59,8 @@ Items that are intentionally undocumented are not included in this section. - `{{name}}` {{/each}} {{/each}} +{{/if}} +{{#if (or draft.resources.length draft.properties.length draft.endpoints.length draft.parameters.length)}} ## Draft @@ -87,6 +92,8 @@ These items have been marked as draft. - `{{name}}` {{/each}} {{/each}} +{{/if}} +{{#if (or deprecated.resourceProperties.length deprecated.endpoints.length deprecated.parameters.length)}} ## Deprecated @@ -112,3 +119,4 @@ These items are deprecated. - `{{name}}`: {{reason}} {{/each}} {{/each}} +{{/if}} diff --git a/src/lib/handlebars-helpers.ts b/src/lib/handlebars-helpers.ts index be9f946c..fed810cd 100644 --- a/src/lib/handlebars-helpers.ts +++ b/src/lib/handlebars-helpers.ts @@ -1,3 +1,10 @@ export const eq = (v1: unknown, v2: unknown): boolean => { return v1 === v2 } + +export const or = (...args: unknown[]): boolean => { + // remove the last argument, which is the Handlebars options object + args.pop() + + return args.some(Boolean) +} diff --git a/src/lib/report.ts b/src/lib/report.ts index 16bf8bbd..592921a3 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -30,7 +30,7 @@ interface ReportSection { interface Report { undocumented: ReportSection - noDescription: ReportSection & { resources: string[] } + noDescription: ReportSection & { resources: ReportItem[] } draft: ReportSection deprecated: ReportSection } @@ -90,7 +90,7 @@ function processResource( report: Report, ): void { if (resource.description == null || resource.description.trim() === '') { - report.noDescription.resources.push(resourceName) + report.noDescription.resources.push({ name: resourceName }) } // TODO: draft, deprecated, undocumented when supported From b94efdbce660d69f4f9c5e48b95b82054c4e4aab Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Mon, 7 Oct 2024 16:14:32 +0000 Subject: [PATCH 13/39] ci: Generate docs --- docs/api/_report.md | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/docs/api/_report.md b/docs/api/_report.md index f23b30fb..a1114cbe 100644 --- a/docs/api/_report.md +++ b/docs/api/_report.md @@ -27,14 +27,14 @@ Items that are intentionally undocumented are not included in this section. ### Resources -- `` -- `` -- `` -- `` -- `` -- `` -- `` -- `` +- `acs_access_group` +- `acs_credential` +- `acs_credential_pool` +- `acs_credential_provisioning_automation` +- `acs_entrance` +- `acs_user` +- `event` +- `thermostat_schedule` ### Resource properties @@ -324,22 +324,6 @@ Items that are intentionally undocumented are not included in this section. - `starts_at` - `thermostat_schedule_id` -## Draft - -These items have been marked as draft. - -### Resources - - -### Resource properties - - -### Endpoints - - -### Endpoint parameters - - ## Deprecated These items are deprecated. From 6fe15eb4876ab5ba5b79564c275c2f49e159d6db Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Mon, 7 Oct 2024 18:18:40 +0200 Subject: [PATCH 14/39] Conditionally render entity sections --- src/layouts/report.hbs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/layouts/report.hbs b/src/layouts/report.hbs index d1d54003..c3351f23 100644 --- a/src/layouts/report.hbs +++ b/src/layouts/report.hbs @@ -4,18 +4,23 @@ ## Undocumented These items are intentionally undocumented. +{{#if undocumented.resourceProperties.length }} ### Resource properties {{#each undocumented.resourceProperties}} - `{{name}}`: {{reason}} {{/each}} +{{/if}} +{{#if undocumented.endpoints.length }} ### Endpoints {{#each undocumented.endpoints}} - `{{name}}`: {{reason}} {{/each}} +{{/if}} +{{#if undocumented.parameters.length }} ### Endpoint parameters @@ -26,30 +31,38 @@ These items are intentionally undocumented. {{/each}} {{/each}} {{/if}} +{{/if}} {{#if (or noDescription.resources.length noDescription.properties.length noDescription.endpoints.length noDescription.parameters.length)}} ## No Description These items have an empty description. Items that are intentionally undocumented are not included in this section. +{{#if noDescription.resources.length }} ### Resources {{#each noDescription.resources}} - `{{name}}` {{/each}} +{{/if}} +{{#if noDescription.properties.length }} ### Resource properties {{#each noDescription.properties}} - `{{name}}` {{/each}} +{{/if}} +{{#if noDescription.endpoints.length }} ### Endpoints {{#each noDescription.endpoints}} - `{{name}}` {{/each}} +{{/if}} +{{#if noDescription.parameters.length }} ### Endpoint parameters @@ -60,29 +73,37 @@ Items that are intentionally undocumented are not included in this section. {{/each}} {{/each}} {{/if}} +{{/if}} {{#if (or draft.resources.length draft.properties.length draft.endpoints.length draft.parameters.length)}} ## Draft These items have been marked as draft. +{{#if draft.resources.length }} ### Resources {{#each draft.resources}} - `{{name}}` {{/each}} +{{/if}} +{{#if draft.properties.length }} ### Resource properties {{#each draft.properties}} - `{{name}}` {{/each}} +{{/if}} +{{#if draft.endpoints.length }} ### Endpoints {{#each draft.endpoints}} - `{{name}}` {{/each}} +{{/if}} +{{#if draft.parameters.length }} ### Endpoint parameters @@ -93,23 +114,29 @@ These items have been marked as draft. {{/each}} {{/each}} {{/if}} +{{/if}} {{#if (or deprecated.resourceProperties.length deprecated.endpoints.length deprecated.parameters.length)}} ## Deprecated These items are deprecated. +{{#if deprecated.resourceProperties.length }} ### Resource properties {{#each deprecated.resourceProperties}} - `{{name}}`: {{reason}} {{/each}} +{{/if}} +{{#if deprecated.endpoints.length }} ### Endpoints {{#each deprecated.endpoints}} - `{{name}}`: {{reason}} {{/each}} +{{/if}} +{{#if deprecated.parameters.length }} ### Endpoint parameters @@ -120,3 +147,4 @@ These items are deprecated. {{/each}} {{/each}} {{/if}} +{{/if}} From 292396add2dd70f9ae23ea11961e73d528628217 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Mon, 7 Oct 2024 16:19:37 +0000 Subject: [PATCH 15/39] ci: Generate docs --- docs/api/_report.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docs/api/_report.md b/docs/api/_report.md index a1114cbe..e439c71d 100644 --- a/docs/api/_report.md +++ b/docs/api/_report.md @@ -17,9 +17,6 @@ These items are intentionally undocumented. - `/acs/users/unmanaged/get`: Intentionally undocumented - `/acs/users/unmanaged/list`: Intentionally undocumented -### Endpoint parameters - - ## No Description These items have an empty description. @@ -36,9 +33,6 @@ Items that are intentionally undocumented are not included in this section. - `event` - `thermostat_schedule` -### Resource properties - - ### Endpoints - `/acs/access_groups/add_user` @@ -336,9 +330,6 @@ These items are deprecated. - `acs_system.system_type_display_name`: Use `external_type_display_name`. - `acs_user.email`: use email_address. -### Endpoints - - ### Endpoint parameters - `/acs/users/create` From 891d311a224cb82f26510c948d0859d4f136172b Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Tue, 8 Oct 2024 16:16:47 +0200 Subject: [PATCH 16/39] Bump blueprint to add some missing draft entities to the report --- package-lock.json | 8 +++--- package.json | 2 +- src/layouts/report.hbs | 2 +- src/lib/report.ts | 57 ++++++++++++++++++++++++++++++++---------- 4 files changed, 50 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index b0732c29..e6af243b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@metalsmith/layouts": "^2.7.0", "@metalsmith/metadata": "^0.3.0", "@prettier/plugin-php": "^0.22.2", - "@seamapi/blueprint": "^0.21.3", + "@seamapi/blueprint": "^0.27.0", "change-case": "^5.4.4", "command-exists": "^1.2.9", "del": "^7.1.0", @@ -631,9 +631,9 @@ } }, "node_modules/@seamapi/blueprint": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-0.21.3.tgz", - "integrity": "sha512-o8VYcXCLcyXmaBhtnvW14pJXuQzj8EzEo1jHERlDlv/yFZldH8ZiwxrF+ZCVVZDeKRs1yyS+QO9WJ79qHBNEFw==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-0.27.0.tgz", + "integrity": "sha512-wOEmvKPIj1kKMfEq0PnG6BrBn7DIffSLWhJ6irzgUJxO0uw+JZscJUSEK9RDRnBsfr7uaah1ij0attSJLb30AQ==", "license": "MIT", "dependencies": { "change-case": "^5.4.4", diff --git a/package.json b/package.json index 400399b4..56312822 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@metalsmith/layouts": "^2.7.0", "@metalsmith/metadata": "^0.3.0", "@prettier/plugin-php": "^0.22.2", - "@seamapi/blueprint": "^0.21.3", + "@seamapi/blueprint": "^0.27.0", "change-case": "^5.4.4", "command-exists": "^1.2.9", "del": "^7.1.0", diff --git a/src/layouts/report.hbs b/src/layouts/report.hbs index c3351f23..f0631d49 100644 --- a/src/layouts/report.hbs +++ b/src/layouts/report.hbs @@ -1,4 +1,4 @@ -# Reference Documentation Report +# Documentation Report {{#if (or undocumented.resourceProperties.length undocumented.endpoints.length undocumented.parameters.length)}} ## Undocumented diff --git a/src/lib/report.ts b/src/lib/report.ts index 592921a3..e837edaa 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -15,7 +15,9 @@ interface ReportItem { reason?: string } -const defaultReason = 'No reason provided' +const defaultDeprecatedMessage = 'No deprecated message provided' +const defaultDraftMessage = 'No draft message provided' +const defaultUndocumentedMessage = 'No undocumented message provided' interface ParameterReportItem { path: string @@ -109,7 +111,7 @@ function processProperty( if (property.isUndocumented) { report.undocumented.resourceProperties.push({ name: propertyName, - reason: 'Intentionally undocumented', // TODO: undocumentedMessage + reason: defaultUndocumentedMessage, // TODO: undocumentedMessage }) } @@ -120,29 +122,41 @@ function processProperty( if (property.isDeprecated) { report.deprecated.resourceProperties.push({ name: propertyName, - reason: property.deprecationMessage ?? defaultReason, + reason: property.deprecationMessage ?? defaultDeprecatedMessage, }) } - // TODO: draft + if (property.isDraft) { + report.draft.resourceProperties.push({ + name: propertyName, + reason: defaultDraftMessage, // TODO: draftMessage + }) + } } function processRoute(route: Route, report: Report): void { if (route.isUndocumented) { report.undocumented.endpoints.push({ name: route.path, - reason: 'Intentionally undocumented', // TODO: undocumentedMessage + reason: defaultUndocumentedMessage, // TODO: undocumentedMessage }) } if (route.isDeprecated) { report.deprecated.endpoints.push({ name: route.path, - reason: defaultReason, // TODO: deprecationMessage + reason: defaultDeprecatedMessage, // TODO: deprecationMessage + }) + } + + if (route.isDraft) { + report.draft.endpoints.push({ + name: route.path, + reason: defaultDraftMessage, // TODO: draftMessage }) } - // TODO: draft, description + // TODO: description for (const endpoint of route.endpoints) { processEndpoint(endpoint, report) @@ -153,7 +167,7 @@ function processEndpoint(endpoint: Endpoint, report: Report): void { if (endpoint.isUndocumented) { report.undocumented.endpoints.push({ name: endpoint.path, - reason: 'Intentionally undocumented', // TODO: undocumentedMessage + reason: defaultUndocumentedMessage, // TODO: undocumentedMessage }) } @@ -164,11 +178,16 @@ function processEndpoint(endpoint: Endpoint, report: Report): void { if (endpoint.isDeprecated) { report.deprecated.endpoints.push({ name: endpoint.path, - reason: endpoint.deprecationMessage ?? defaultReason, + reason: endpoint.deprecationMessage ?? defaultDeprecatedMessage, }) } - // TODO: draft + if (endpoint.isDraft) { + report.draft.endpoints.push({ + name: endpoint.path, + reason: defaultDraftMessage, // TODO: draftMessage + }) + } processParameters(endpoint.path, endpoint.request.parameters, report) } @@ -183,7 +202,7 @@ function processParameters( if (param.isUndocumented) { acc.undocumented.push({ name: param.name, - reason: 'Intentionally undocumented', // TODO: undocumentedMessage + reason: defaultUndocumentedMessage, // TODO: undocumentedMessage }) } @@ -194,11 +213,16 @@ function processParameters( if (param.isDeprecated) { acc.deprecated.push({ name: param.name, - reason: param.deprecationMessage ?? defaultReason, + reason: param.deprecationMessage ?? defaultDeprecatedMessage, }) } - // TODO: draft + if (param.isDraft) { + acc.draft.push({ + name: param.name, + reason: defaultDraftMessage, // TODO: draftMessage + }) + } return acc }, @@ -206,6 +230,7 @@ function processParameters( undocumented: [] as ReportItem[], noDescription: [] as string[], deprecated: [] as ReportItem[], + draft: [] as ReportItem[], }, ) @@ -227,4 +252,10 @@ function processParameters( params: categorizedParams.deprecated, }) } + if (categorizedParams.draft.length > 0) { + report.draft.parameters.push({ + path, + params: categorizedParams.draft, + }) + } } From fc3b753b287e879ed1ede81b5ccce9e07bc32c26 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Tue, 8 Oct 2024 16:19:19 +0200 Subject: [PATCH 17/39] Minor fix --- src/lib/report.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/report.ts b/src/lib/report.ts index e837edaa..13081aa0 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -207,7 +207,7 @@ function processParameters( } if (param.description == null || param.description.trim() === '') { - acc.noDescription.push(param.name) + acc.noDescription.push({ name: param.name }) } if (param.isDeprecated) { @@ -228,7 +228,7 @@ function processParameters( }, { undocumented: [] as ReportItem[], - noDescription: [] as string[], + noDescription: [] as ReportItem[], deprecated: [] as ReportItem[], draft: [] as ReportItem[], }, @@ -243,7 +243,7 @@ function processParameters( if (categorizedParams.noDescription.length > 0) { report.noDescription.parameters.push({ path, - params: categorizedParams.noDescription.map((name) => ({ name })), + params: categorizedParams.noDescription, }) } if (categorizedParams.deprecated.length > 0) { From 33fa350bc8801077fcbd896c93c46a18d1d742af Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 9 Oct 2024 11:49:35 +0200 Subject: [PATCH 18/39] Bump blueprint and seam types --- package-lock.json | 17 +++++++++-------- package.json | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index e6af243b..875d1fcb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@metalsmith/layouts": "^2.7.0", "@metalsmith/metadata": "^0.3.0", "@prettier/plugin-php": "^0.22.2", - "@seamapi/blueprint": "^0.27.0", + "@seamapi/blueprint": "^0.27.4", "change-case": "^5.4.4", "command-exists": "^1.2.9", "del": "^7.1.0", @@ -22,7 +22,7 @@ "prettier": "^3.0.0" }, "devDependencies": { - "@seamapi/types": "1.258.1", + "@seamapi/types": "1.262.1", "@types/command-exists": "^1.2.3", "@types/debug": "^4.1.12", "@types/micromatch": "^4.0.9", @@ -631,9 +631,9 @@ } }, "node_modules/@seamapi/blueprint": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-0.27.0.tgz", - "integrity": "sha512-wOEmvKPIj1kKMfEq0PnG6BrBn7DIffSLWhJ6irzgUJxO0uw+JZscJUSEK9RDRnBsfr7uaah1ij0attSJLb30AQ==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-0.27.4.tgz", + "integrity": "sha512-cR7ne56LIpBjQtt9z7LwEiiKDvUPF/X8/upJsnQBaqg4lW3CxB/kjCdA2Z7Sf+uLSwhXeO5GfhCQQrIzdiOh/w==", "license": "MIT", "dependencies": { "change-case": "^5.4.4", @@ -645,10 +645,11 @@ } }, "node_modules/@seamapi/types": { - "version": "1.258.1", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.258.1.tgz", - "integrity": "sha512-ZfcuFrngPQGVBuExX/2jVOzO4iH78TAxlwsvvY/dQx4eTQ9QIShnPEa3NPBzlF45X/ULQ+sIF5icTPs/SpnfNw==", + "version": "1.262.1", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.262.1.tgz", + "integrity": "sha512-AlwwSnSFQNeTB1rGYqtztJII9vieEbcmaLuFtK1PokFQSan+u/B5esuh1ZPPfRSGP7QWNThpBdvuP0z6vAii4Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=18.12.0", "npm": ">= 9.0.0" diff --git a/package.json b/package.json index 56312822..61335ef1 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@metalsmith/layouts": "^2.7.0", "@metalsmith/metadata": "^0.3.0", "@prettier/plugin-php": "^0.22.2", - "@seamapi/blueprint": "^0.27.0", + "@seamapi/blueprint": "^0.27.4", "change-case": "^5.4.4", "command-exists": "^1.2.9", "del": "^7.1.0", @@ -42,7 +42,7 @@ "prettier": "^3.0.0" }, "devDependencies": { - "@seamapi/types": "1.258.1", + "@seamapi/types": "1.262.1", "@types/command-exists": "^1.2.3", "@types/debug": "^4.1.12", "@types/micromatch": "^4.0.9", From e70519e30a5dc9743629008f02280c5bd997b861 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 9 Oct 2024 11:57:56 +0200 Subject: [PATCH 19/39] Process depreceted, undocumented and draft resources --- src/lib/report.ts | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/lib/report.ts b/src/lib/report.ts index 13081aa0..3637fafd 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -25,6 +25,7 @@ interface ParameterReportItem { } interface ReportSection { + resources: ReportItem[] resourceProperties: ReportItem[] endpoints: ReportItem[] parameters: ParameterReportItem[] @@ -80,6 +81,7 @@ function generateReport(metadata: Metadata): Report { function createEmptyReportSection(): ReportSection { return { + resources: [], resourceProperties: [], endpoints: [], parameters: [], @@ -94,7 +96,27 @@ function processResource( if (resource.description == null || resource.description.trim() === '') { report.noDescription.resources.push({ name: resourceName }) } - // TODO: draft, deprecated, undocumented when supported + + if (resource.isDeprecated) { + report.deprecated.resources.push({ + name: resourceName, + reason: resource.deprecationMessage ?? defaultDeprecatedMessage, + }) + } + + if (resource.isUndocumented) { + report.undocumented.resources.push({ + name: resourceName, + reason: resource.undocumentedMessage ?? defaultUndocumentedMessage, + }) + + if (resource.isDraft) { + report.draft.resources.push({ + name: resourceName, + reason: resource.draftMessage ?? defaultDraftMessage, + }) + } + } for (const property of resource.properties) { processProperty(resourceName, property, report) From 93b00d503077073b7edf965552228b64624327b3 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Wed, 9 Oct 2024 09:58:42 +0000 Subject: [PATCH 20/39] ci: Generate docs --- docs/api/_report.md | 18 ++++---- docs/api/acs/systems/get.md | 45 +++++++++++++++++++ docs/api/acs/systems/list.md | 45 +++++++++++++++++++ ...mpatible_credential_manager_acs_systems.md | 45 +++++++++++++++++++ 4 files changed, 145 insertions(+), 8 deletions(-) diff --git a/docs/api/_report.md b/docs/api/_report.md index e439c71d..5fc501fc 100644 --- a/docs/api/_report.md +++ b/docs/api/_report.md @@ -1,4 +1,4 @@ -# Reference Documentation Report +# Documentation Report ## Undocumented @@ -6,16 +6,18 @@ These items are intentionally undocumented. ### Resource properties -- `acs_user.is_latest_desired_state_synced_with_provider`: Intentionally undocumented -- `acs_user.latest_desired_state_synced_with_provider_at`: Intentionally undocumented +- `acs_user.is_latest_desired_state_synced_with_provider`: No undocumented message provided +- `acs_user.latest_desired_state_synced_with_provider_at`: No undocumented message provided ### Endpoints -- `/acs/encoders/encode_card`: Intentionally undocumented -- `/acs/encoders/read_card`: Intentionally undocumented -- `/acs/users/unmanaged`: Intentionally undocumented -- `/acs/users/unmanaged/get`: Intentionally undocumented -- `/acs/users/unmanaged/list`: Intentionally undocumented +- `/acs/encoders`: No undocumented message provided +- `/acs/encoders/encode_card`: No undocumented message provided +- `/acs/encoders/list`: No undocumented message provided +- `/acs/encoders/read_card`: No undocumented message provided +- `/acs/users/unmanaged`: No undocumented message provided +- `/acs/users/unmanaged/get`: No undocumented message provided +- `/acs/users/unmanaged/list`: No undocumented message provided ## No Description diff --git a/docs/api/acs/systems/get.md b/docs/api/acs/systems/get.md index 5134aee5..9e02863c 100644 --- a/docs/api/acs/systems/get.md +++ b/docs/api/acs/systems/get.md @@ -82,6 +82,51 @@ seam acs systems get --acs_system_id "8d7e0b3a-b889-49a7-9164-4b71a0506a33" ``` {% endtab %} +{% tab title="Go" %} +#### Request + +```go +import api "github.com/seamapi/go" +import systems "github.com/seamapi/go/systems" + + client.Acs.Systems.Get(context.Background(), systems.SystemsGetRequest(AcsSystemId: api.String("8d7e0b3a-b889-49a7-9164-4b71a0506a33"))) +``` + +#### Response + +```go +[]api.AcsSystem{api.AcsSystem{AcsSystemId: "8d7e0b3a-b889-49a7-9164-4b71a0506a33"}} +``` +{% endtab %} + +{% tab title="Java" %} +#### Request + +```java +seam.acs().systems().get(SystemsGetRequest.builder().acsSystemId("8d7e0b3a-b889-49a7-9164-4b71a0506a33").build()); +``` + +#### Response + +```java +[{ "acs_system_id": "8d7e0b3a-b889-49a7-9164-4b71a0506a33" }] +``` +{% endtab %} + +{% tab title="C#" %} +#### Request + +```csharp +seam.Acs.Systems.Get(acsSystemId: "8d7e0b3a-b889-49a7-9164-4b71a0506a33") +``` + +#### Response + +```csharp +[{ "acs_system_id": "8d7e0b3a-b889-49a7-9164-4b71a0506a33" }] +``` +{% endtab %} + {% endtabs %} ## Request Parameters diff --git a/docs/api/acs/systems/list.md b/docs/api/acs/systems/list.md index 77adad3c..712ea20d 100644 --- a/docs/api/acs/systems/list.md +++ b/docs/api/acs/systems/list.md @@ -86,6 +86,51 @@ seam acs systems list --connected_account_id "123e4567-e89b-12d3-a456-4266141740 ``` {% endtab %} +{% tab title="Go" %} +#### Request + +```go +import api "github.com/seamapi/go" +import systems "github.com/seamapi/go/systems" + + client.Acs.Systems.List(context.Background(), systems.SystemsListRequest(ConnectedAccountId: api.String("123e4567-e89b-12d3-a456-426614174000"))) +``` + +#### Response + +```go +[]api.AcsSystem{api.AcsSystem{AcsSystemId: "8d7e0b3a-b889-49a7-9164-4b71a0506a33"}} +``` +{% endtab %} + +{% tab title="Java" %} +#### Request + +```java +seam.acs().systems().list(SystemsListRequest.builder().connectedAccountId("123e4567-e89b-12d3-a456-426614174000").build()); +``` + +#### Response + +```java +[{ "acs_system_id": "8d7e0b3a-b889-49a7-9164-4b71a0506a33" }] +``` +{% endtab %} + +{% tab title="C#" %} +#### Request + +```csharp +seam.Acs.Systems.List(connectedAccountId: "123e4567-e89b-12d3-a456-426614174000") +``` + +#### Response + +```csharp +[{ "acs_system_id": "8d7e0b3a-b889-49a7-9164-4b71a0506a33" }] +``` +{% endtab %} + {% endtabs %} ## Request Parameters diff --git a/docs/api/acs/systems/list_compatible_credential_manager_acs_systems.md b/docs/api/acs/systems/list_compatible_credential_manager_acs_systems.md index d5711dc3..9f68bbed 100644 --- a/docs/api/acs/systems/list_compatible_credential_manager_acs_systems.md +++ b/docs/api/acs/systems/list_compatible_credential_manager_acs_systems.md @@ -88,6 +88,51 @@ seam acs systems list-compatible-credential-manager-acs-systems --acs_system_id ``` {% endtab %} +{% tab title="Go" %} +#### Request + +```go +import api "github.com/seamapi/go" +import systems "github.com/seamapi/go/systems" + + client.Acs.Systems.ListCompatibleCredentialManagerAcsSystems(context.Background(), systems.SystemsListCompatibleCredentialManagerAcsSystemsRequest(AcsSystemId: api.String("8d7e0b3a-b889-49a7-9164-4b71a0506a33"))) +``` + +#### Response + +```go +[]api.AcsSystem{api.AcsSystem{AcsSystemId: "aczp0sgx-gl9f-nygd-r11e-7pc1zufn55z4"}} +``` +{% endtab %} + +{% tab title="Java" %} +#### Request + +```java +seam.acs().systems().listCompatibleCredentialManagerAcsSystems(SystemsListCompatibleCredentialManagerAcsSystemsRequest.builder().acsSystemId("8d7e0b3a-b889-49a7-9164-4b71a0506a33").build()); +``` + +#### Response + +```java +[{ "acs_system_id": "aczp0sgx-gl9f-nygd-r11e-7pc1zufn55z4" }] +``` +{% endtab %} + +{% tab title="C#" %} +#### Request + +```csharp +seam.Acs.Systems.ListCompatibleCredentialManagerAcsSystems(acsSystemId: "8d7e0b3a-b889-49a7-9164-4b71a0506a33") +``` + +#### Response + +```csharp +[{ "acs_system_id": "aczp0sgx-gl9f-nygd-r11e-7pc1zufn55z4" }] +``` +{% endtab %} + {% endtabs %} ## Request Parameters From 2db8e3750e09e02e4b4efd494ce752fe3ec2a19c Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 9 Oct 2024 13:25:12 +0200 Subject: [PATCH 21/39] Add some of the missing messages --- src/lib/report.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/report.ts b/src/lib/report.ts index 3637fafd..99e41254 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -133,7 +133,7 @@ function processProperty( if (property.isUndocumented) { report.undocumented.resourceProperties.push({ name: propertyName, - reason: defaultUndocumentedMessage, // TODO: undocumentedMessage + reason: property.undocumentedMessage ?? defaultUndocumentedMessage, }) } @@ -151,7 +151,7 @@ function processProperty( if (property.isDraft) { report.draft.resourceProperties.push({ name: propertyName, - reason: defaultDraftMessage, // TODO: draftMessage + reason: property.draftMessage ?? defaultDraftMessage, }) } } @@ -189,7 +189,7 @@ function processEndpoint(endpoint: Endpoint, report: Report): void { if (endpoint.isUndocumented) { report.undocumented.endpoints.push({ name: endpoint.path, - reason: defaultUndocumentedMessage, // TODO: undocumentedMessage + reason: endpoint.undocumentedMessage ?? defaultUndocumentedMessage, }) } @@ -207,7 +207,7 @@ function processEndpoint(endpoint: Endpoint, report: Report): void { if (endpoint.isDraft) { report.draft.endpoints.push({ name: endpoint.path, - reason: defaultDraftMessage, // TODO: draftMessage + reason: endpoint.draftMessage ?? defaultDraftMessage, }) } @@ -224,7 +224,7 @@ function processParameters( if (param.isUndocumented) { acc.undocumented.push({ name: param.name, - reason: defaultUndocumentedMessage, // TODO: undocumentedMessage + reason: param.undocumentedMessage ?? defaultUndocumentedMessage, }) } @@ -242,7 +242,7 @@ function processParameters( if (param.isDraft) { acc.draft.push({ name: param.name, - reason: defaultDraftMessage, // TODO: draftMessage + reason: param.draftMessage ?? defaultDraftMessage, }) } From 662df68cb925aa489416492acd94ba6319394bb6 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Wed, 9 Oct 2024 11:26:16 +0000 Subject: [PATCH 22/39] ci: Generate docs --- docs/api/_report.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/api/_report.md b/docs/api/_report.md index 5fc501fc..6a201f71 100644 --- a/docs/api/_report.md +++ b/docs/api/_report.md @@ -6,18 +6,18 @@ These items are intentionally undocumented. ### Resource properties -- `acs_user.is_latest_desired_state_synced_with_provider`: No undocumented message provided -- `acs_user.latest_desired_state_synced_with_provider_at`: No undocumented message provided +- `acs_user.is_latest_desired_state_synced_with_provider`: Only used internally. +- `acs_user.latest_desired_state_synced_with_provider_at`: Only used internally. ### Endpoints - `/acs/encoders`: No undocumented message provided -- `/acs/encoders/encode_card`: No undocumented message provided -- `/acs/encoders/list`: No undocumented message provided -- `/acs/encoders/read_card`: No undocumented message provided +- `/acs/encoders/encode_card`: Encoding a card is currently unimplemented. +- `/acs/encoders/list`: Encoders are in alpha. +- `/acs/encoders/read_card`: Reading a card is currently unimplemented. - `/acs/users/unmanaged`: No undocumented message provided -- `/acs/users/unmanaged/get`: No undocumented message provided -- `/acs/users/unmanaged/list`: No undocumented message provided +- `/acs/users/unmanaged/get`: No unmanaged users are currently implemented. +- `/acs/users/unmanaged/list`: No unmanaged users are currently implemented. ## No Description From 77464be0612c69f7600522caa4e9bfcc95e6da5d Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 9 Oct 2024 13:44:18 +0200 Subject: [PATCH 23/39] Process namespaces --- src/layouts/report.hbs | 40 ++++++++++++++++++++++++++++++++++++---- src/lib/report.ts | 29 ++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/src/layouts/report.hbs b/src/layouts/report.hbs index f0631d49..841b0c3b 100644 --- a/src/layouts/report.hbs +++ b/src/layouts/report.hbs @@ -1,5 +1,5 @@ # Documentation Report -{{#if (or undocumented.resourceProperties.length undocumented.endpoints.length undocumented.parameters.length)}} +{{#if (or undocumented.resourceProperties.length undocumented.endpoints.length undocumented.parameters.length undocumented.namespaces.length)}} ## Undocumented @@ -12,6 +12,14 @@ These items are intentionally undocumented. - `{{name}}`: {{reason}} {{/each}} {{/if}} +{{#if undocumented.namespaces.length }} + +### Namespaces + +{{#each undocumented.namespaces}} +- `{{name}}`: {{reason}} +{{/each}} +{{/if}} {{#if undocumented.endpoints.length }} ### Endpoints @@ -32,7 +40,7 @@ These items are intentionally undocumented. {{/each}} {{/if}} {{/if}} -{{#if (or noDescription.resources.length noDescription.properties.length noDescription.endpoints.length noDescription.parameters.length)}} +{{#if (or noDescription.resources.length noDescription.properties.length noDescription.endpoints.length noDescription.parameters.length noDescription.namespaces.length)}} ## No Description @@ -54,6 +62,14 @@ Items that are intentionally undocumented are not included in this section. - `{{name}}` {{/each}} {{/if}} +{{#if noDescription.namespaces.length }} + +### Namespaces + +{{#each noDescription.namespaces}} +- `{{name}}` +{{/each}} +{{/if}} {{#if noDescription.endpoints.length }} ### Endpoints @@ -74,7 +90,7 @@ Items that are intentionally undocumented are not included in this section. {{/each}} {{/if}} {{/if}} -{{#if (or draft.resources.length draft.properties.length draft.endpoints.length draft.parameters.length)}} +{{#if (or draft.resources.length draft.properties.length draft.endpoints.length draft.parameters.length draft.namespaces.length)}} ## Draft @@ -95,6 +111,14 @@ These items have been marked as draft. - `{{name}}` {{/each}} {{/if}} +{{#if draft.namespaces.length }} + +### Namespaces + +{{#each draft.namespaces}} +- `{{name}}` +{{/each}} +{{/if}} {{#if draft.endpoints.length }} ### Endpoints @@ -115,7 +139,7 @@ These items have been marked as draft. {{/each}} {{/if}} {{/if}} -{{#if (or deprecated.resourceProperties.length deprecated.endpoints.length deprecated.parameters.length)}} +{{#if (or deprecated.resourceProperties.length deprecated.endpoints.length deprecated.parameters.length deprecated.namespaces.length)}} ## Deprecated @@ -128,6 +152,14 @@ These items are deprecated. - `{{name}}`: {{reason}} {{/each}} {{/if}} +{{#if deprecated.namespaces.length }} + +### Namespaces + +{{#each deprecated.namespaces}} +- `{{name}}`: {{reason}} +{{/each}} +{{/if}} {{#if deprecated.endpoints.length }} ### Endpoints diff --git a/src/lib/report.ts b/src/lib/report.ts index 99e41254..144323d3 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -5,6 +5,7 @@ import type { Property, Resource, Route, + Namespace } from '@seamapi/blueprint' import type Metalsmith from 'metalsmith' @@ -29,6 +30,7 @@ interface ReportSection { resourceProperties: ReportItem[] endpoints: ReportItem[] parameters: ParameterReportItem[] + namespaces: ReportItem[] } interface Report { @@ -85,6 +87,7 @@ function createEmptyReportSection(): ReportSection { resourceProperties: [], endpoints: [], parameters: [], + namespaces: [], } } @@ -178,13 +181,37 @@ function processRoute(route: Route, report: Report): void { }) } - // TODO: description + if (route.namespace != null) { + processNamespace(route.namespace, report) + } + + // TODO: route description for (const endpoint of route.endpoints) { processEndpoint(endpoint, report) } } +function processNamespace(namespace: Namespace, report: Report): void { + const addNamespace = (section: ReportItem[], reason: string) => { + if (!section.some((item) => item.name === namespace.path)) { + section.push({ name: namespace.path, reason }) + } + } + + if (namespace.isDeprecated) { + addNamespace(report.deprecated.namespaces, defaultDeprecatedMessage) + } + + if (namespace.isDraft) { + addNamespace(report.draft.namespaces, defaultDraftMessage) + } + + if (namespace.isUndocumented) { + addNamespace(report.undocumented.namespaces, defaultUndocumentedMessage) + } +} + function processEndpoint(endpoint: Endpoint, report: Report): void { if (endpoint.isUndocumented) { report.undocumented.endpoints.push({ From fc0bb21801da9c32d68ebe6d3b3abf5cca3d3782 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Wed, 9 Oct 2024 11:45:18 +0000 Subject: [PATCH 24/39] ci: Format code --- src/lib/report.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/report.ts b/src/lib/report.ts index 144323d3..cb9fd0bb 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -1,11 +1,11 @@ import type { Blueprint, Endpoint, + Namespace, Parameter, Property, Resource, Route, - Namespace } from '@seamapi/blueprint' import type Metalsmith from 'metalsmith' From 10406ec39228f362d77b4d053e41eeb9a12399e2 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 9 Oct 2024 13:48:54 +0200 Subject: [PATCH 25/39] Add missing reasons to the report layout --- src/layouts/report.hbs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/layouts/report.hbs b/src/layouts/report.hbs index 841b0c3b..5baf21ab 100644 --- a/src/layouts/report.hbs +++ b/src/layouts/report.hbs @@ -100,7 +100,7 @@ These items have been marked as draft. ### Resources {{#each draft.resources}} -- `{{name}}` +- `{{name}}`: {{reason}} {{/each}} {{/if}} {{#if draft.properties.length }} @@ -108,7 +108,7 @@ These items have been marked as draft. ### Resource properties {{#each draft.properties}} -- `{{name}}` +- `{{name}}`: {{reason}} {{/each}} {{/if}} {{#if draft.namespaces.length }} @@ -116,7 +116,7 @@ These items have been marked as draft. ### Namespaces {{#each draft.namespaces}} -- `{{name}}` +- `{{name}}`: {{reason}} {{/each}} {{/if}} {{#if draft.endpoints.length }} @@ -124,7 +124,7 @@ These items have been marked as draft. ### Endpoints {{#each draft.endpoints}} -- `{{name}}` +- `{{name}}`: {{reason}} {{/each}} {{/if}} {{#if draft.parameters.length }} @@ -134,7 +134,7 @@ These items have been marked as draft. {{#each draft.parameters}} - `{{path}}` {{#each params}} - - `{{name}}` + - `{{name}}`: {{reason}} {{/each}} {{/each}} {{/if}} From 657db802c2c7ec182d80f5a0fe6f1014c89e8a81 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 9 Oct 2024 13:53:17 +0200 Subject: [PATCH 26/39] Fix resource properties usage in the layout --- src/layouts/report.hbs | 12 ++++++------ src/lib/report.ts | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/layouts/report.hbs b/src/layouts/report.hbs index 5baf21ab..2561a49e 100644 --- a/src/layouts/report.hbs +++ b/src/layouts/report.hbs @@ -40,7 +40,7 @@ These items are intentionally undocumented. {{/each}} {{/if}} {{/if}} -{{#if (or noDescription.resources.length noDescription.properties.length noDescription.endpoints.length noDescription.parameters.length noDescription.namespaces.length)}} +{{#if (or noDescription.resources.length noDescription.resourceProperties.length noDescription.endpoints.length noDescription.parameters.length noDescription.namespaces.length)}} ## No Description @@ -54,11 +54,11 @@ Items that are intentionally undocumented are not included in this section. - `{{name}}` {{/each}} {{/if}} -{{#if noDescription.properties.length }} +{{#if noDescription.resourceProperties.length }} ### Resource properties -{{#each noDescription.properties}} +{{#each noDescription.resourceProperties}} - `{{name}}` {{/each}} {{/if}} @@ -90,7 +90,7 @@ Items that are intentionally undocumented are not included in this section. {{/each}} {{/if}} {{/if}} -{{#if (or draft.resources.length draft.properties.length draft.endpoints.length draft.parameters.length draft.namespaces.length)}} +{{#if (or draft.resources.length draft.resourceProperties.length draft.endpoints.length draft.parameters.length draft.namespaces.length)}} ## Draft @@ -103,11 +103,11 @@ These items have been marked as draft. - `{{name}}`: {{reason}} {{/each}} {{/if}} -{{#if draft.properties.length }} +{{#if draft.resourceProperties.length }} ### Resource properties -{{#each draft.properties}} +{{#each draft.resourceProperties}} - `{{name}}`: {{reason}} {{/each}} {{/if}} diff --git a/src/lib/report.ts b/src/lib/report.ts index cb9fd0bb..d831a7d1 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -28,14 +28,14 @@ interface ParameterReportItem { interface ReportSection { resources: ReportItem[] resourceProperties: ReportItem[] + namespaces: ReportItem[] endpoints: ReportItem[] parameters: ParameterReportItem[] - namespaces: ReportItem[] } interface Report { undocumented: ReportSection - noDescription: ReportSection & { resources: ReportItem[] } + noDescription: ReportSection draft: ReportSection deprecated: ReportSection } From ec699a5581ff976eef6b9b29ba604398d29b1509 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 9 Oct 2024 14:01:09 +0200 Subject: [PATCH 27/39] Add missing resource/route sections to the layout --- src/layouts/report.hbs | 56 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/src/layouts/report.hbs b/src/layouts/report.hbs index 2561a49e..d523578d 100644 --- a/src/layouts/report.hbs +++ b/src/layouts/report.hbs @@ -1,9 +1,25 @@ # Documentation Report -{{#if (or undocumented.resourceProperties.length undocumented.endpoints.length undocumented.parameters.length undocumented.namespaces.length)}} +{{#if (or undocumented.routes.length undocumented.resources.length undocumented.resourceProperties.length undocumented.namespaces.length undocumented.endpoints.length undocumented.parameters.length)}} ## Undocumented These items are intentionally undocumented. +{{#if undocumented.routes.length }} + +### Routes + +{{#each undocumented.routes}} +- `{{name}}`: {{reason}} +{{/each}} +{{/if}} +{{#if undocumented.resources.length }} + +### Resources + +{{#each undocumented.resources}} +- `{{name}}`: {{reason}} +{{/each}} +{{/if}} {{#if undocumented.resourceProperties.length }} ### Resource properties @@ -40,12 +56,20 @@ These items are intentionally undocumented. {{/each}} {{/if}} {{/if}} -{{#if (or noDescription.resources.length noDescription.resourceProperties.length noDescription.endpoints.length noDescription.parameters.length noDescription.namespaces.length)}} +{{#if (or noDescription.routes.length noDescription.resources.length noDescription.resourceProperties.length noDescription.namespaces.length noDescription.endpoints.length noDescription.parameters.length)}} ## No Description These items have an empty description. Items that are intentionally undocumented are not included in this section. +{{#if noDescription.routes.length }} + +### Routes + +{{#each noDescription.routes}} +- `{{name}}` +{{/each}} +{{/if}} {{#if noDescription.resources.length }} ### Resources @@ -90,11 +114,19 @@ Items that are intentionally undocumented are not included in this section. {{/each}} {{/if}} {{/if}} -{{#if (or draft.resources.length draft.resourceProperties.length draft.endpoints.length draft.parameters.length draft.namespaces.length)}} +{{#if (or draft.routes.length draft.resources.length draft.resourceProperties.length draft.namespaces.length draft.endpoints.length draft.parameters.length)}} ## Draft These items have been marked as draft. +{{#if draft.routes.length }} + +### Routes + +{{#each draft.routes}} +- `{{name}}`: {{reason}} +{{/each}} +{{/if}} {{#if draft.resources.length }} ### Resources @@ -139,11 +171,27 @@ These items have been marked as draft. {{/each}} {{/if}} {{/if}} -{{#if (or deprecated.resourceProperties.length deprecated.endpoints.length deprecated.parameters.length deprecated.namespaces.length)}} +{{#if (or deprecated.routes.length deprecated.resources.length deprecated.resourceProperties.length deprecated.namespaces.length deprecated.endpoints.length deprecated.parameters.length)}} ## Deprecated These items are deprecated. +{{#if deprecated.routes.length }} + +### Routes + +{{#each deprecated.routes}} +- `{{name}}`: {{reason}} +{{/each}} +{{/if}} +{{#if deprecated.resources.length }} + +### Resources + +{{#each deprecated.resources}} +- `{{name}}`: {{reason}} +{{/each}} +{{/if}} {{#if deprecated.resourceProperties.length }} ### Resource properties From 51432f9ec061cdec4e32324a858a0b19c810c41d Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 9 Oct 2024 14:02:22 +0200 Subject: [PATCH 28/39] Lint --- src/lib/report.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/report.ts b/src/lib/report.ts index d831a7d1..14611b97 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -193,7 +193,7 @@ function processRoute(route: Route, report: Report): void { } function processNamespace(namespace: Namespace, report: Report): void { - const addNamespace = (section: ReportItem[], reason: string) => { + const addNamespace = (section: ReportItem[], reason: string): void => { if (!section.some((item) => item.name === namespace.path)) { section.push({ name: namespace.path, reason }) } From bd587807903a32e99b3da1eb4ee38ff73185b3e3 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Wed, 9 Oct 2024 12:03:14 +0000 Subject: [PATCH 29/39] ci: Generate docs --- docs/api/_report.md | 92 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/docs/api/_report.md b/docs/api/_report.md index 6a201f71..e5ca9166 100644 --- a/docs/api/_report.md +++ b/docs/api/_report.md @@ -35,6 +35,98 @@ Items that are intentionally undocumented are not included in this section. - `event` - `thermostat_schedule` +### Resource properties + +- `acs_access_group.access_group_type` +- `acs_access_group.access_group_type_display_name` +- `acs_access_group.acs_access_group_id` +- `acs_access_group.acs_system_id` +- `acs_access_group.created_at` +- `acs_access_group.display_name` +- `acs_access_group.external_type` +- `acs_access_group.external_type_display_name` +- `acs_access_group.is_managed` +- `acs_access_group.name` +- `acs_access_group.workspace_id` +- `acs_credential.access_method` +- `acs_credential.acs_credential_id` +- `acs_credential.acs_credential_pool_id` +- `acs_credential.acs_system_id` +- `acs_credential.acs_user_id` +- `acs_credential.card_number` +- `acs_credential.code` +- `acs_credential.created_at` +- `acs_credential.display_name` +- `acs_credential.ends_at` +- `acs_credential.errors` +- `acs_credential.external_type` +- `acs_credential.external_type_display_name` +- `acs_credential.is_issued` +- `acs_credential.is_latest_desired_state_synced_with_provider` +- `acs_credential.is_managed` +- `acs_credential.is_multi_phone_sync_credential` +- `acs_credential.issued_at` +- `acs_credential.latest_desired_state_synced_with_provider_at` +- `acs_credential.parent_acs_credential_id` +- `acs_credential.starts_at` +- `acs_credential.visionline_metadata` +- `acs_credential.warnings` +- `acs_credential.workspace_id` +- `acs_credential_pool.acs_credential_pool_id` +- `acs_credential_pool.acs_system_id` +- `acs_credential_pool.created_at` +- `acs_credential_pool.display_name` +- `acs_credential_pool.external_type` +- `acs_credential_pool.external_type_display_name` +- `acs_credential_pool.workspace_id` +- `acs_credential_provisioning_automation.acs_credential_provisioning_automation_id` +- `acs_credential_provisioning_automation.created_at` +- `acs_credential_provisioning_automation.credential_manager_acs_system_id` +- `acs_credential_provisioning_automation.user_identity_id` +- `acs_credential_provisioning_automation.workspace_id` +- `acs_entrance.errors` +- `acs_entrance.latch_metadata` +- `acs_entrance.salto_ks_metadata` +- `acs_entrance.visionline_metadata` +- `acs_system.system_type` +- `acs_system.system_type_display_name` +- `acs_system.visionline_metadata` +- `acs_user.email` +- `acs_user.hid_acs_system_id` +- `acs_user.is_latest_desired_state_synced_with_provider` +- `acs_user.is_managed` +- `acs_user.latest_desired_state_synced_with_provider_at` +- `event.acs_credential_id` +- `event.acs_system_id` +- `event.acs_user_id` +- `event.action_attempt_id` +- `event.client_session_id` +- `event.climate_preset_key` +- `event.cooling_set_point_celsius` +- `event.cooling_set_point_fahrenheit` +- `event.created_at` +- `event.device_id` +- `event.enrollment_automation_id` +- `event.event_description` +- `event.event_id` +- `event.event_type` +- `event.fan_mode_setting` +- `event.heating_set_point_celsius` +- `event.heating_set_point_fahrenheit` +- `event.hvac_mode_setting` +- `event.is_fallback_climate_preset` +- `event.occurred_at` +- `event.thermostat_schedule_id` +- `event.workspace_id` +- `thermostat_schedule.climate_preset_key` +- `thermostat_schedule.created_at` +- `thermostat_schedule.device_id` +- `thermostat_schedule.ends_at` +- `thermostat_schedule.max_override_period_minutes` +- `thermostat_schedule.name` +- `thermostat_schedule.starts_at` +- `thermostat_schedule.thermostat_schedule_id` + ### Endpoints - `/acs/access_groups/add_user` From 8c0fea38df68650a0c0336d1e05713cc28414e19 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 9 Oct 2024 14:54:31 +0200 Subject: [PATCH 30/39] Report about extra response keys --- src/layouts/report.hbs | 11 ++++++ src/lib/report.ts | 83 +++++++++++++++++++++++++++++++++--------- 2 files changed, 76 insertions(+), 18 deletions(-) diff --git a/src/layouts/report.hbs b/src/layouts/report.hbs index d523578d..b93aec76 100644 --- a/src/layouts/report.hbs +++ b/src/layouts/report.hbs @@ -228,3 +228,14 @@ These items are deprecated. {{/each}} {{/if}} {{/if}} +{{#if extraResponseKeys.length }} + +### Extra response keys + +{{#each extraResponseKeys}} +- `{{path}}` + {{#each keys}} + - `{{this}}` + {{/each}} +{{/each}} +{{/if}} diff --git a/src/lib/report.ts b/src/lib/report.ts index 14611b97..19f89f28 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -7,22 +7,19 @@ import type { Resource, Route, } from '@seamapi/blueprint' +import { openapi } from '@seamapi/types/connect' import type Metalsmith from 'metalsmith' -type Metadata = Partial> - -interface ReportItem { - name: string - reason?: string -} - const defaultDeprecatedMessage = 'No deprecated message provided' const defaultDraftMessage = 'No draft message provided' const defaultUndocumentedMessage = 'No undocumented message provided' -interface ParameterReportItem { - path: string - params: ReportItem[] +interface Report { + undocumented: ReportSection + noDescription: ReportSection + draft: ReportSection + deprecated: ReportSection + extraResponseKeys: MissingResponseKeyReport[] } interface ReportSection { @@ -33,13 +30,23 @@ interface ReportSection { parameters: ParameterReportItem[] } -interface Report { - undocumented: ReportSection - noDescription: ReportSection - draft: ReportSection - deprecated: ReportSection +interface MissingResponseKeyReport { + path: string + keys: string[] } +interface ReportItem { + name: string + reason?: string +} + +interface ParameterReportItem { + path: string + params: ReportItem[] +} + +type Metadata = Partial> + export const report = ( files: Metalsmith.Files, metalsmith: Metalsmith, @@ -66,6 +73,7 @@ function generateReport(metadata: Metadata): Report { noDescription: { ...createEmptyReportSection(), resources: [] }, draft: { ...createEmptyReportSection(), resourceProperties: [] }, deprecated: createEmptyReportSection(), + extraResponseKeys: [], } const resources = metadata.resources ?? {} @@ -194,9 +202,9 @@ function processRoute(route: Route, report: Report): void { function processNamespace(namespace: Namespace, report: Report): void { const addNamespace = (section: ReportItem[], reason: string): void => { - if (!section.some((item) => item.name === namespace.path)) { - section.push({ name: namespace.path, reason }) - } + if (section.some((item) => item.name === namespace.path)) return + + section.push({ name: namespace.path, reason }) } if (namespace.isDeprecated) { @@ -238,9 +246,48 @@ function processEndpoint(endpoint: Endpoint, report: Report): void { }) } + processResponseKeys(endpoint, report) + processParameters(endpoint.path, endpoint.request.parameters, report) } +function processResponseKeys(endpoint: Endpoint, report: Report): void { + if (!('responseKey' in endpoint.response)) return + + const openapiResponseSchemaProps = getOpenapiResponseProperties(endpoint.path) + if (openapiResponseSchemaProps == null) return + + const openapiResponsePropKeys = Object.keys( + openapiResponseSchemaProps, + ).filter((key) => key !== 'ok') + if (openapiResponsePropKeys.length <= 1) return + + const endpointResponseKey = endpoint.response.responseKey + const extraResponseKeys = openapiResponsePropKeys.filter( + (key) => key !== endpointResponseKey, + ) + + report.extraResponseKeys.push({ + path: endpoint.path, + keys: extraResponseKeys, + }) +} + +function getOpenapiResponseProperties( + path: string, +): Record | undefined { + const openapiEndpointDef = openapi.paths[path as keyof typeof openapi.paths] + + if (openapiEndpointDef == null) { + // eslint-disable-next-line no-console + console.warn(`OpenAPI definition not found for endpoint: ${path}`) + return + } + + return openapiEndpointDef.post.responses['200']?.content['application/json'] + ?.schema?.properties +} + function processParameters( path: string, parameters: Parameter[], From 316e5f5e4366c1c2fb0db9fc7586a6624c02d19e Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Wed, 9 Oct 2024 12:55:17 +0000 Subject: [PATCH 31/39] ci: Generate docs --- docs/api/_report.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/api/_report.md b/docs/api/_report.md index e5ca9166..7106fd40 100644 --- a/docs/api/_report.md +++ b/docs/api/_report.md @@ -434,3 +434,8 @@ These items are deprecated. - `email`: use email_address. - `/thermostats/set_fan_mode` - `fan_mode`: use fan_mode_setting instead. + +### Extra response keys + +- `/events/get` + - `message` From c6704e064f52c498c3ee234f6fd9abf839372d72 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 9 Oct 2024 15:04:36 +0200 Subject: [PATCH 32/39] Add section on endpoints without code samples --- src/layouts/report.hbs | 8 ++++++++ src/lib/report.ts | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/src/layouts/report.hbs b/src/layouts/report.hbs index b93aec76..7a502881 100644 --- a/src/layouts/report.hbs +++ b/src/layouts/report.hbs @@ -239,3 +239,11 @@ These items are deprecated. {{/each}} {{/each}} {{/if}} +{{#if endpointsWithoutCodeSamples.length }} + +### Endpoints without code samples + +{{#each endpointsWithoutCodeSamples}} +- `{{this}}` +{{/each}} +{{/if}} diff --git a/src/lib/report.ts b/src/lib/report.ts index 19f89f28..6459ad97 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -20,6 +20,7 @@ interface Report { draft: ReportSection deprecated: ReportSection extraResponseKeys: MissingResponseKeyReport[] + endpointsWithoutCodeSamples: string[] } interface ReportSection { @@ -74,6 +75,7 @@ function generateReport(metadata: Metadata): Report { draft: { ...createEmptyReportSection(), resourceProperties: [] }, deprecated: createEmptyReportSection(), extraResponseKeys: [], + endpointsWithoutCodeSamples: [], } const resources = metadata.resources ?? {} @@ -246,6 +248,10 @@ function processEndpoint(endpoint: Endpoint, report: Report): void { }) } + if (endpoint.codeSamples.length === 0) { + report.endpointsWithoutCodeSamples.push(endpoint.path) + } + processResponseKeys(endpoint, report) processParameters(endpoint.path, endpoint.request.parameters, report) From 9651d424edbd54784f9f1eefebcec8c7d75a57c9 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Wed, 9 Oct 2024 13:05:35 +0000 Subject: [PATCH 33/39] ci: Generate docs --- docs/api/_report.md | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/docs/api/_report.md b/docs/api/_report.md index 7106fd40..cbf77132 100644 --- a/docs/api/_report.md +++ b/docs/api/_report.md @@ -439,3 +439,73 @@ These items are deprecated. - `/events/get` - `message` + +### Endpoints without code samples + +- `/acs/access_groups/add_user` +- `/acs/access_groups/add_user` +- `/acs/access_groups/get` +- `/acs/access_groups/list` +- `/acs/access_groups/list_accessible_entrances` +- `/acs/access_groups/list_users` +- `/acs/access_groups/remove_user` +- `/acs/access_groups/unmanaged/get` +- `/acs/access_groups/unmanaged/list` +- `/acs/credential_pools/list` +- `/acs/credential_provisioning_automations/launch` +- `/acs/credentials/assign` +- `/acs/credentials/assign` +- `/acs/credentials/create` +- `/acs/credentials/delete` +- `/acs/credentials/get` +- `/acs/credentials/list` +- `/acs/credentials/list_accessible_entrances` +- `/acs/credentials/unassign` +- `/acs/credentials/unassign` +- `/acs/credentials/update` +- `/acs/credentials/update` +- `/acs/credentials/unmanaged/get` +- `/acs/credentials/unmanaged/list` +- `/acs/encoders/encode_card` +- `/acs/encoders/list` +- `/acs/encoders/read_card` +- `/acs/entrances/get` +- `/acs/entrances/grant_access` +- `/acs/entrances/list` +- `/acs/entrances/list_credentials_with_access` +- `/acs/users/add_to_access_group` +- `/acs/users/add_to_access_group` +- `/acs/users/create` +- `/acs/users/delete` +- `/acs/users/get` +- `/acs/users/list` +- `/acs/users/list_accessible_entrances` +- `/acs/users/remove_from_access_group` +- `/acs/users/revoke_access_to_all_entrances` +- `/acs/users/suspend` +- `/acs/users/unsuspend` +- `/acs/users/update` +- `/acs/users/update` +- `/acs/users/unmanaged/get` +- `/acs/users/unmanaged/list` +- `/events/get` +- `/events/list` +- `/thermostats/activate_climate_preset` +- `/thermostats/cool` +- `/thermostats/create_climate_preset` +- `/thermostats/delete_climate_preset` +- `/thermostats/get` +- `/thermostats/heat` +- `/thermostats/heat_cool` +- `/thermostats/list` +- `/thermostats/off` +- `/thermostats/set_fallback_climate_preset` +- `/thermostats/set_fan_mode` +- `/thermostats/update_climate_preset` +- `/thermostats/update_climate_preset` +- `/thermostats/schedules/create` +- `/thermostats/schedules/delete` +- `/thermostats/schedules/get` +- `/thermostats/schedules/list` +- `/thermostats/schedules/update` +- `/thermostats/schedules/update` From 16d2e092ef22322e4afa76b2c097b17cdce006a3 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 9 Oct 2024 15:08:55 +0200 Subject: [PATCH 34/39] Remove pattern key --- src/metalsmith.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/metalsmith.ts b/src/metalsmith.ts index 3fb8b610..8883f81b 100644 --- a/src/metalsmith.ts +++ b/src/metalsmith.ts @@ -33,7 +33,6 @@ Metalsmith(rootDir) .use( layouts({ default: 'default.hbs', - pattern: '**/*.md', engineOptions: { noEscape: true, helpers, From eb968c82e289af60798158b3951abc434c5c04fc Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 9 Oct 2024 15:40:01 +0200 Subject: [PATCH 35/39] Fix bug in processRoute --- src/lib/report.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/report.ts b/src/lib/report.ts index 6459ad97..5f03435e 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -24,6 +24,7 @@ interface Report { } interface ReportSection { + routes: ReportItem[] resources: ReportItem[] resourceProperties: ReportItem[] namespaces: ReportItem[] @@ -98,6 +99,7 @@ function createEmptyReportSection(): ReportSection { endpoints: [], parameters: [], namespaces: [], + routes: [], } } @@ -171,21 +173,21 @@ function processProperty( function processRoute(route: Route, report: Report): void { if (route.isUndocumented) { - report.undocumented.endpoints.push({ + report.undocumented.routes.push({ name: route.path, reason: defaultUndocumentedMessage, // TODO: undocumentedMessage }) } if (route.isDeprecated) { - report.deprecated.endpoints.push({ + report.deprecated.routes.push({ name: route.path, reason: defaultDeprecatedMessage, // TODO: deprecationMessage }) } if (route.isDraft) { - report.draft.endpoints.push({ + report.draft.routes.push({ name: route.path, reason: defaultDraftMessage, // TODO: draftMessage }) From e30ff9ffc7dc537f56f9682264f3d0e9f454ef36 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Wed, 9 Oct 2024 13:40:53 +0000 Subject: [PATCH 36/39] ci: Generate docs --- docs/api/_report.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/api/_report.md b/docs/api/_report.md index cbf77132..f7dc661d 100644 --- a/docs/api/_report.md +++ b/docs/api/_report.md @@ -4,6 +4,11 @@ These items are intentionally undocumented. +### Routes + +- `/acs/encoders`: No undocumented message provided +- `/acs/users/unmanaged`: No undocumented message provided + ### Resource properties - `acs_user.is_latest_desired_state_synced_with_provider`: Only used internally. @@ -11,11 +16,9 @@ These items are intentionally undocumented. ### Endpoints -- `/acs/encoders`: No undocumented message provided - `/acs/encoders/encode_card`: Encoding a card is currently unimplemented. - `/acs/encoders/list`: Encoders are in alpha. - `/acs/encoders/read_card`: Reading a card is currently unimplemented. -- `/acs/users/unmanaged`: No undocumented message provided - `/acs/users/unmanaged/get`: No unmanaged users are currently implemented. - `/acs/users/unmanaged/list`: No unmanaged users are currently implemented. From b29e2ee66a695d562e447513e756882ce4218ed9 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Thu, 10 Oct 2024 13:59:13 +0200 Subject: [PATCH 37/39] Dedupe reported endpoints and endpoint params --- src/lib/report.ts | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/src/lib/report.ts b/src/lib/report.ts index 5f03435e..c0cddc72 100644 --- a/src/lib/report.ts +++ b/src/lib/report.ts @@ -226,32 +226,34 @@ function processNamespace(namespace: Namespace, report: Report): void { function processEndpoint(endpoint: Endpoint, report: Report): void { if (endpoint.isUndocumented) { - report.undocumented.endpoints.push({ + addUniqueEndpoint(report.undocumented.endpoints, { name: endpoint.path, reason: endpoint.undocumentedMessage ?? defaultUndocumentedMessage, }) } if (endpoint.description == null || endpoint.description.trim() === '') { - report.noDescription.endpoints.push({ name: endpoint.path }) + addUniqueEndpoint(report.noDescription.endpoints, { name: endpoint.path }) } if (endpoint.isDeprecated) { - report.deprecated.endpoints.push({ + addUniqueEndpoint(report.deprecated.endpoints, { name: endpoint.path, reason: endpoint.deprecationMessage ?? defaultDeprecatedMessage, }) } if (endpoint.isDraft) { - report.draft.endpoints.push({ + addUniqueEndpoint(report.draft.endpoints, { name: endpoint.path, reason: endpoint.draftMessage ?? defaultDraftMessage, }) } if (endpoint.codeSamples.length === 0) { - report.endpointsWithoutCodeSamples.push(endpoint.path) + if (!report.endpointsWithoutCodeSamples.includes(endpoint.path)) { + report.endpointsWithoutCodeSamples.push(endpoint.path) + } } processResponseKeys(endpoint, report) @@ -259,6 +261,17 @@ function processEndpoint(endpoint: Endpoint, report: Report): void { processParameters(endpoint.path, endpoint.request.parameters, report) } +function addUniqueEndpoint( + reportedEndpoints: ReportItem[], + newEndpoint: ReportItem, +): void { + if ( + !reportedEndpoints.some((endpoint) => endpoint.name === newEndpoint.name) + ) { + reportedEndpoints.push(newEndpoint) + } +} + function processResponseKeys(endpoint: Endpoint, report: Report): void { if (!('responseKey' in endpoint.response)) return @@ -339,27 +352,38 @@ function processParameters( ) if (categorizedParams.undocumented.length > 0) { - report.undocumented.parameters.push({ + addUniqueParameters(report.undocumented.parameters, { path, params: categorizedParams.undocumented, }) } if (categorizedParams.noDescription.length > 0) { - report.noDescription.parameters.push({ + addUniqueParameters(report.noDescription.parameters, { path, params: categorizedParams.noDescription, }) } if (categorizedParams.deprecated.length > 0) { - report.deprecated.parameters.push({ + addUniqueParameters(report.deprecated.parameters, { path, params: categorizedParams.deprecated, }) } if (categorizedParams.draft.length > 0) { - report.draft.parameters.push({ + addUniqueParameters(report.draft.parameters, { path, params: categorizedParams.draft, }) } } + +const addUniqueParameters = ( + reportedParams: ParameterReportItem[], + newParam: ParameterReportItem, +): void => { + if (reportedParams.some((param) => param.path === newParam.path)) { + return + } + + reportedParams.push(newParam) +} From c450eed66d8c77df3f9922425d6bb7049a6f88f7 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Thu, 10 Oct 2024 12:00:03 +0000 Subject: [PATCH 38/39] ci: Generate docs --- docs/api/_report.md | 50 --------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/docs/api/_report.md b/docs/api/_report.md index f7dc661d..7d24fa1f 100644 --- a/docs/api/_report.md +++ b/docs/api/_report.md @@ -132,7 +132,6 @@ Items that are intentionally undocumented are not included in this section. ### Endpoints -- `/acs/access_groups/add_user` - `/acs/access_groups/add_user` - `/acs/access_groups/get` - `/acs/access_groups/list` @@ -144,15 +143,12 @@ Items that are intentionally undocumented are not included in this section. - `/acs/credential_pools/list` - `/acs/credential_provisioning_automations/launch` - `/acs/credentials/assign` -- `/acs/credentials/assign` - `/acs/credentials/create` - `/acs/credentials/delete` - `/acs/credentials/get` - `/acs/credentials/list` - `/acs/credentials/list_accessible_entrances` - `/acs/credentials/unassign` -- `/acs/credentials/unassign` -- `/acs/credentials/update` - `/acs/credentials/update` - `/acs/credentials/unmanaged/get` - `/acs/credentials/unmanaged/list` @@ -179,19 +175,14 @@ Items that are intentionally undocumented are not included in this section. - `/thermostats/set_fallback_climate_preset` - `/thermostats/set_fan_mode` - `/thermostats/update_climate_preset` -- `/thermostats/update_climate_preset` - `/thermostats/schedules/create` - `/thermostats/schedules/delete` - `/thermostats/schedules/get` - `/thermostats/schedules/list` - `/thermostats/schedules/update` -- `/thermostats/schedules/update` ### Endpoint parameters -- `/acs/access_groups/add_user` - - `acs_access_group_id` - - `acs_user_id` - `/acs/access_groups/add_user` - `acs_access_group_id` - `acs_user_id` @@ -223,9 +214,6 @@ Items that are intentionally undocumented are not included in this section. - `/acs/credentials/assign` - `acs_credential_id` - `acs_user_id` -- `/acs/credentials/assign` - - `acs_credential_id` - - `acs_user_id` - `/acs/credentials/create` - `access_method` - `acs_user_id` @@ -245,13 +233,6 @@ Items that are intentionally undocumented are not included in this section. - `/acs/credentials/unassign` - `acs_credential_id` - `acs_user_id` -- `/acs/credentials/unassign` - - `acs_credential_id` - - `acs_user_id` -- `/acs/credentials/update` - - `acs_credential_id` - - `code` - - `ends_at` - `/acs/credentials/update` - `acs_credential_id` - `code` @@ -277,9 +258,6 @@ Items that are intentionally undocumented are not included in this section. - `/acs/users/update` - `email` - `hid_acs_system_id` -- `/acs/users/update` - - `email` - - `hid_acs_system_id` - `/acs/users/unmanaged/get` - `acs_user_id` - `/acs/users/unmanaged/list` @@ -375,17 +353,6 @@ Items that are intentionally undocumented are not included in this section. - `hvac_mode_setting` - `manual_override_allowed` - `name` -- `/thermostats/update_climate_preset` - - `climate_preset_key` - - `cooling_set_point_celsius` - - `cooling_set_point_fahrenheit` - - `device_id` - - `fan_mode_setting` - - `heating_set_point_celsius` - - `heating_set_point_fahrenheit` - - `hvac_mode_setting` - - `manual_override_allowed` - - `name` - `/thermostats/schedules/create` - `climate_preset_key` - `device_id` @@ -407,13 +374,6 @@ Items that are intentionally undocumented are not included in this section. - `name` - `starts_at` - `thermostat_schedule_id` -- `/thermostats/schedules/update` - - `climate_preset_key` - - `ends_at` - - `max_override_period_minutes` - - `name` - - `starts_at` - - `thermostat_schedule_id` ## Deprecated @@ -433,8 +393,6 @@ These items are deprecated. - `email`: use email_address. - `/acs/users/update` - `email`: use email_address. -- `/acs/users/update` - - `email`: use email_address. - `/thermostats/set_fan_mode` - `fan_mode`: use fan_mode_setting instead. @@ -445,7 +403,6 @@ These items are deprecated. ### Endpoints without code samples -- `/acs/access_groups/add_user` - `/acs/access_groups/add_user` - `/acs/access_groups/get` - `/acs/access_groups/list` @@ -457,15 +414,12 @@ These items are deprecated. - `/acs/credential_pools/list` - `/acs/credential_provisioning_automations/launch` - `/acs/credentials/assign` -- `/acs/credentials/assign` - `/acs/credentials/create` - `/acs/credentials/delete` - `/acs/credentials/get` - `/acs/credentials/list` - `/acs/credentials/list_accessible_entrances` - `/acs/credentials/unassign` -- `/acs/credentials/unassign` -- `/acs/credentials/update` - `/acs/credentials/update` - `/acs/credentials/unmanaged/get` - `/acs/credentials/unmanaged/list` @@ -477,7 +431,6 @@ These items are deprecated. - `/acs/entrances/list` - `/acs/entrances/list_credentials_with_access` - `/acs/users/add_to_access_group` -- `/acs/users/add_to_access_group` - `/acs/users/create` - `/acs/users/delete` - `/acs/users/get` @@ -488,7 +441,6 @@ These items are deprecated. - `/acs/users/suspend` - `/acs/users/unsuspend` - `/acs/users/update` -- `/acs/users/update` - `/acs/users/unmanaged/get` - `/acs/users/unmanaged/list` - `/events/get` @@ -505,10 +457,8 @@ These items are deprecated. - `/thermostats/set_fallback_climate_preset` - `/thermostats/set_fan_mode` - `/thermostats/update_climate_preset` -- `/thermostats/update_climate_preset` - `/thermostats/schedules/create` - `/thermostats/schedules/delete` - `/thermostats/schedules/get` - `/thermostats/schedules/list` - `/thermostats/schedules/update` -- `/thermostats/schedules/update` From 9d75d6f87601a95eaf40831d02b35e16b8834ad1 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Thu, 10 Oct 2024 18:20:05 +0000 Subject: [PATCH 39/39] ci: Generate docs --- docs/api/_report.md | 2 + docs/api/acs/systems/get.md | 45 ------------------- docs/api/acs/systems/list.md | 45 ------------------- ...mpatible_credential_manager_acs_systems.md | 45 ------------------- 4 files changed, 2 insertions(+), 135 deletions(-) diff --git a/docs/api/_report.md b/docs/api/_report.md index 7d24fa1f..b2c2d3aa 100644 --- a/docs/api/_report.md +++ b/docs/api/_report.md @@ -400,6 +400,8 @@ These items are deprecated. - `/events/get` - `message` +- `/thermostats/list` + - `thermostats` ### Endpoints without code samples diff --git a/docs/api/acs/systems/get.md b/docs/api/acs/systems/get.md index 9e02863c..5134aee5 100644 --- a/docs/api/acs/systems/get.md +++ b/docs/api/acs/systems/get.md @@ -82,51 +82,6 @@ seam acs systems get --acs_system_id "8d7e0b3a-b889-49a7-9164-4b71a0506a33" ``` {% endtab %} -{% tab title="Go" %} -#### Request - -```go -import api "github.com/seamapi/go" -import systems "github.com/seamapi/go/systems" - - client.Acs.Systems.Get(context.Background(), systems.SystemsGetRequest(AcsSystemId: api.String("8d7e0b3a-b889-49a7-9164-4b71a0506a33"))) -``` - -#### Response - -```go -[]api.AcsSystem{api.AcsSystem{AcsSystemId: "8d7e0b3a-b889-49a7-9164-4b71a0506a33"}} -``` -{% endtab %} - -{% tab title="Java" %} -#### Request - -```java -seam.acs().systems().get(SystemsGetRequest.builder().acsSystemId("8d7e0b3a-b889-49a7-9164-4b71a0506a33").build()); -``` - -#### Response - -```java -[{ "acs_system_id": "8d7e0b3a-b889-49a7-9164-4b71a0506a33" }] -``` -{% endtab %} - -{% tab title="C#" %} -#### Request - -```csharp -seam.Acs.Systems.Get(acsSystemId: "8d7e0b3a-b889-49a7-9164-4b71a0506a33") -``` - -#### Response - -```csharp -[{ "acs_system_id": "8d7e0b3a-b889-49a7-9164-4b71a0506a33" }] -``` -{% endtab %} - {% endtabs %} ## Request Parameters diff --git a/docs/api/acs/systems/list.md b/docs/api/acs/systems/list.md index e22876ae..5e9daa47 100644 --- a/docs/api/acs/systems/list.md +++ b/docs/api/acs/systems/list.md @@ -86,51 +86,6 @@ seam acs systems list --connected_account_id "123e4567-e89b-12d3-a456-4266141740 ``` {% endtab %} -{% tab title="Go" %} -#### Request - -```go -import api "github.com/seamapi/go" -import systems "github.com/seamapi/go/systems" - - client.Acs.Systems.List(context.Background(), systems.SystemsListRequest(ConnectedAccountId: api.String("123e4567-e89b-12d3-a456-426614174000"))) -``` - -#### Response - -```go -[]api.AcsSystem{api.AcsSystem{AcsSystemId: "8d7e0b3a-b889-49a7-9164-4b71a0506a33"}} -``` -{% endtab %} - -{% tab title="Java" %} -#### Request - -```java -seam.acs().systems().list(SystemsListRequest.builder().connectedAccountId("123e4567-e89b-12d3-a456-426614174000").build()); -``` - -#### Response - -```java -[{ "acs_system_id": "8d7e0b3a-b889-49a7-9164-4b71a0506a33" }] -``` -{% endtab %} - -{% tab title="C#" %} -#### Request - -```csharp -seam.Acs.Systems.List(connectedAccountId: "123e4567-e89b-12d3-a456-426614174000") -``` - -#### Response - -```csharp -[{ "acs_system_id": "8d7e0b3a-b889-49a7-9164-4b71a0506a33" }] -``` -{% endtab %} - {% endtabs %} ## Request Parameters diff --git a/docs/api/acs/systems/list_compatible_credential_manager_acs_systems.md b/docs/api/acs/systems/list_compatible_credential_manager_acs_systems.md index 3bbba97e..3f490163 100644 --- a/docs/api/acs/systems/list_compatible_credential_manager_acs_systems.md +++ b/docs/api/acs/systems/list_compatible_credential_manager_acs_systems.md @@ -88,51 +88,6 @@ seam acs systems list-compatible-credential-manager-acs-systems --acs_system_id ``` {% endtab %} -{% tab title="Go" %} -#### Request - -```go -import api "github.com/seamapi/go" -import systems "github.com/seamapi/go/systems" - - client.Acs.Systems.ListCompatibleCredentialManagerAcsSystems(context.Background(), systems.SystemsListCompatibleCredentialManagerAcsSystemsRequest(AcsSystemId: api.String("8d7e0b3a-b889-49a7-9164-4b71a0506a33"))) -``` - -#### Response - -```go -[]api.AcsSystem{api.AcsSystem{AcsSystemId: "aczp0sgx-gl9f-nygd-r11e-7pc1zufn55z4"}} -``` -{% endtab %} - -{% tab title="Java" %} -#### Request - -```java -seam.acs().systems().listCompatibleCredentialManagerAcsSystems(SystemsListCompatibleCredentialManagerAcsSystemsRequest.builder().acsSystemId("8d7e0b3a-b889-49a7-9164-4b71a0506a33").build()); -``` - -#### Response - -```java -[{ "acs_system_id": "aczp0sgx-gl9f-nygd-r11e-7pc1zufn55z4" }] -``` -{% endtab %} - -{% tab title="C#" %} -#### Request - -```csharp -seam.Acs.Systems.ListCompatibleCredentialManagerAcsSystems(acsSystemId: "8d7e0b3a-b889-49a7-9164-4b71a0506a33") -``` - -#### Response - -```csharp -[{ "acs_system_id": "aczp0sgx-gl9f-nygd-r11e-7pc1zufn55z4" }] -``` -{% endtab %} - {% endtabs %} ## Request Parameters