@workos/oagen-emitters 0.7.5 → 0.8.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.
@@ -42,6 +42,35 @@ function ctxFor(services: Service[], enums = baseSpec.enums): EmitterContext {
42
42
  }
43
43
 
44
44
  describe('kotlin/resources', () => {
45
+ it('wraps every path-template interpolation in encodePathSegment', () => {
46
+ const services: Service[] = [
47
+ {
48
+ name: 'Users',
49
+ operations: [
50
+ {
51
+ name: 'getUser',
52
+ httpMethod: 'get',
53
+ path: '/users/{id}/groups/{groupId}',
54
+ pathParams: [
55
+ { name: 'id', type: { kind: 'primitive', type: 'string' }, required: true },
56
+ { name: 'groupId', type: { kind: 'primitive', type: 'string' }, required: true },
57
+ ],
58
+ queryParams: [],
59
+ headerParams: [],
60
+ response: { kind: 'primitive', type: 'unknown' },
61
+ errors: [],
62
+ injectIdempotencyKey: false,
63
+ },
64
+ ],
65
+ },
66
+ ];
67
+ const files = generateResources(services, ctxFor(services));
68
+ const file = files.find((f) => f.path.endsWith('/Users.kt'))!;
69
+ expect(file.content).toContain('import com.workos.common.http.encodePathSegment');
70
+ expect(file.content).toContain('path = "/users/${encodePathSegment(id)}/groups/${encodePathSegment(groupId)}"');
71
+ expect(file.content).not.toMatch(/path = "[^"]*\$id[^{]/);
72
+ });
73
+
45
74
  it('collapses duplicated query/body params into a single Kotlin parameter', () => {
46
75
  const services: Service[] = [
47
76
  {