@domain-first/project-structure 2.17.0 → 2.17.1

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/dist/index.cjs CHANGED
@@ -353,13 +353,18 @@ const findHandlerClass = (endpointFile: SourceFile) =>
353
353
  ?.getDeclarations()
354
354
  .find(Node.isClassDeclaration);
355
355
 
356
+ // Path parameters (\`:id\`) can't be part of file and folder names
357
+ // everywhere (Windows), so endpoints name them \`_id_\` there.
358
+ const pathParameterAsName = (segment: string) =>
359
+ segment.startsWith(':') ? \`_\${segment.slice(1)}_\` : segment;
360
+
356
361
  export const createOpenApiDataFromEndpointLogicExtractor = ({
357
362
  summary: summaryTag,
358
363
  description: descriptionTag = '@description'
359
364
  }: OpenApiDataTags = {}) => {
360
365
  return (routeMetadata: {
361
366
  method: string;
362
- path: string[];
367
+ path: readonly string[];
363
368
  }): OpenApiData | undefined => {
364
369
  try {
365
370
  const [currentBoundedContext, controller, ...relativePath] =
@@ -376,7 +381,7 @@ export const createOpenApiDataFromEndpointLogicExtractor = ({
376
381
  'presentation',
377
382
  'rest',
378
383
  controller,
379
- ...relativePath,
384
+ ...relativePath.map(pathParameterAsName),
380
385
  \`\${routeMetadata.method.toUpperCase()}.ts\`
381
386
  )
382
387
  );
package/dist/index.js CHANGED
@@ -323,13 +323,18 @@ const findHandlerClass = (endpointFile: SourceFile) =>
323
323
  ?.getDeclarations()
324
324
  .find(Node.isClassDeclaration);
325
325
 
326
+ // Path parameters (\`:id\`) can't be part of file and folder names
327
+ // everywhere (Windows), so endpoints name them \`_id_\` there.
328
+ const pathParameterAsName = (segment: string) =>
329
+ segment.startsWith(':') ? \`_\${segment.slice(1)}_\` : segment;
330
+
326
331
  export const createOpenApiDataFromEndpointLogicExtractor = ({
327
332
  summary: summaryTag,
328
333
  description: descriptionTag = '@description'
329
334
  }: OpenApiDataTags = {}) => {
330
335
  return (routeMetadata: {
331
336
  method: string;
332
- path: string[];
337
+ path: readonly string[];
333
338
  }): OpenApiData | undefined => {
334
339
  try {
335
340
  const [currentBoundedContext, controller, ...relativePath] =
@@ -346,7 +351,7 @@ export const createOpenApiDataFromEndpointLogicExtractor = ({
346
351
  'presentation',
347
352
  'rest',
348
353
  controller,
349
- ...relativePath,
354
+ ...relativePath.map(pathParameterAsName),
350
355
  \`\${routeMetadata.method.toUpperCase()}.ts\`
351
356
  )
352
357
  );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@domain-first/project-structure",
3
3
  "description": "Build and manage your Domain-First project structure with CLI",
4
- "version": "2.17.0",
4
+ "version": "2.17.1",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",