@groton/canvas-api.swagger-renderer 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [0.1.4](https://github.com/groton-school/canvas-cli/compare/swagger-renderer/0.1.3...swagger-renderer/0.1.4) (2026-01-13)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * convert wild card path param to regular path param ([7ba5107](https://github.com/groton-school/canvas-cli/commit/7ba5107cf9f7fb07c4a69977efff3c57a94a4829))
11
+
5
12
  ## [0.1.3](https://github.com/groton-school/canvas-cli/compare/swagger-renderer/0.1.2...swagger-renderer/0.1.3) (2026-01-05)
6
13
 
7
14
 
@@ -67,11 +67,15 @@ export function annotateOperations({ outputPath, ...annotation }) {
67
67
  specPath,
68
68
  tsImports,
69
69
  tsType,
70
- tsEndpoint: decodeURIComponent(new URL(spec.basePath + endpoint.path).pathname),
70
+ tsEndpoint: decodeURIComponent(new URL(spec.basePath + endpoint.path).pathname.replace(/\/\*([^/]+\/?)/, '/{$1}')),
71
71
  tsName,
72
72
  tsUpload,
73
73
  tsPaginated
74
74
  });
75
+ const wildcardParam = identifyWildcardParam(endpoint.path);
76
+ if (wildcardParam) {
77
+ annotatedOperation.parameters.push(wildcardParam);
78
+ }
75
79
  annotatedOperation.tsFilePath = path.join(outputPath, toOperationPath(endpoint.path, annotatedOperation), annotatedOperation.tsName + '.ts');
76
80
  for (const parameter of operation.parameters) {
77
81
  const annotatedParameter = {
@@ -150,7 +154,7 @@ function toOperationPath(endpointPath, operation) {
150
154
  return operation.parameters
151
155
  .reduce((tsFilePath, parameter) => {
152
156
  if (parameter.paramType === 'path') {
153
- return tsFilePath.replace(new RegExp(`{${parameter.name}}/?`), '');
157
+ return tsFilePath.replace(new RegExp(`{${parameter.name}}/?|\\*${parameter.name}/?`), '');
154
158
  }
155
159
  return tsFilePath;
156
160
  }, endpointPath)
@@ -163,6 +167,19 @@ function toOperationPath(endpointPath, operation) {
163
167
  : undefined)
164
168
  .join('/');
165
169
  }
170
+ function identifyWildcardParam(endpointPath) {
171
+ const [, name] = endpointPath.match(/\/\*([^/]+)\/?/) || [];
172
+ if (name) {
173
+ return {
174
+ paramType: 'path',
175
+ name,
176
+ description: `Identified by @groton/canvas-api.swagger-renderer from the endpoint path: ${endpointPath}`,
177
+ type: 'string',
178
+ required: true
179
+ };
180
+ }
181
+ return undefined;
182
+ }
166
183
  function toTSMethodName(operation) {
167
184
  switch (operation.method) {
168
185
  case 'GET':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@groton/canvas-api.swagger-renderer",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Render Canvas LMS Swagger 1.0 API documentation as TypeScript client",
5
5
  "homepage": "https://github.com/groton-school/canvas-cli/tree/main/packages/api/swagger-renderer#readme",
6
6
  "repository": {