@goast/typescript 0.0.2 → 0.0.3

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/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # typescript
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Building
6
-
7
- Run `nx build typescript` to build the library.
8
-
9
- ## Running unit tests
10
-
11
- Run `nx test typescript` to execute the unit tests via [Jest](https://jestjs.io).
1
+ # typescript
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build typescript` to build the library.
8
+
9
+ ## Running unit tests
10
+
11
+ Run `nx test typescript` to execute the unit tests via [Jest](https://jestjs.io).
@@ -31,6 +31,7 @@ export class UrlBuilder {
31
31
  .map((key) => `${key}=${this.queryParams[key]}`)
32
32
  .join('&');
33
33
  const path = this.path.replace(/\{([^}]+)\}/g, (_, name) => this.pathParams[name]);
34
- return `${this.baseUrl}${path || '/'}${queryString ? '?' + queryString : ''}`;
34
+ const url = `${this.baseUrl}${path || '/'}${queryString ? '?' + queryString : ''}`;
35
+ return url.replace(/(?<!:)[\\/]+(?=\/)|[\\/](?=\?)/g, '');
35
36
  }
36
37
  }
@@ -161,7 +161,7 @@ class DefaultTypeScriptFetchClientGenerator extends file_generator_1.TypeScriptF
161
161
  .append('params: ')
162
162
  .parenthesize('{}', (builder) => builder.forEach(params, (builder, parameter) => {
163
163
  var _a;
164
- return builder.appendLine(`${this.toPropertyName(ctx, parameter.name)}: ${this.getTypeName(ctx, builder, (_a = parameter.schema) === null || _a === void 0 ? void 0 : _a.id)};`);
164
+ return builder.appendLine(this.toPropertyName(ctx, parameter.name), parameter.required ? ': ' : '?: ', this.getTypeName(ctx, builder, (_a = parameter.schema) === null || _a === void 0 ? void 0 : _a.id), ';');
165
165
  }), { indent: true, multiline: true }))
166
166
  .appendLineIf(params.length > 0 && !!bodySchemaId, ',')
167
167
  .appendIf(!!bodySchemaId, (builder) => builder.append(`body: ${this.getTypeName(ctx, builder, bodySchemaId)}`))
@@ -158,7 +158,7 @@ export class DefaultTypeScriptFetchClientGenerator extends TypeScriptFileGenerat
158
158
  .append('params: ')
159
159
  .parenthesize('{}', (builder) => builder.forEach(params, (builder, parameter) => {
160
160
  var _a;
161
- return builder.appendLine(`${this.toPropertyName(ctx, parameter.name)}: ${this.getTypeName(ctx, builder, (_a = parameter.schema) === null || _a === void 0 ? void 0 : _a.id)};`);
161
+ return builder.appendLine(this.toPropertyName(ctx, parameter.name), parameter.required ? ': ' : '?: ', this.getTypeName(ctx, builder, (_a = parameter.schema) === null || _a === void 0 ? void 0 : _a.id), ';');
162
162
  }), { indent: true, multiline: true }))
163
163
  .appendLineIf(params.length > 0 && !!bodySchemaId, ',')
164
164
  .appendIf(!!bodySchemaId, (builder) => builder.append(`body: ${this.getTypeName(ctx, builder, bodySchemaId)}`))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goast/typescript",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "repository": "https://github.com/MaSch0212/goast.git",
5
5
  "author": {
6
6
  "name": "Marc Schmidt (MaSch0212)",