@workos/oagen-emitters 0.3.0 → 0.4.0

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.
Files changed (65) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +7 -0
  3. package/dist/index.d.mts +4 -1
  4. package/dist/index.d.mts.map +1 -1
  5. package/dist/index.mjs +3288 -791
  6. package/dist/index.mjs.map +1 -1
  7. package/docs/sdk-architecture/dotnet.md +336 -0
  8. package/oagen.config.ts +42 -12
  9. package/package.json +2 -2
  10. package/smoke/sdk-dotnet.ts +45 -12
  11. package/src/dotnet/client.ts +89 -0
  12. package/src/dotnet/enums.ts +323 -0
  13. package/src/dotnet/fixtures.ts +236 -0
  14. package/src/dotnet/index.ts +246 -0
  15. package/src/dotnet/manifest.ts +36 -0
  16. package/src/dotnet/models.ts +344 -0
  17. package/src/dotnet/naming.ts +330 -0
  18. package/src/dotnet/resources.ts +622 -0
  19. package/src/dotnet/tests.ts +693 -0
  20. package/src/dotnet/type-map.ts +201 -0
  21. package/src/dotnet/wrappers.ts +186 -0
  22. package/src/go/index.ts +5 -2
  23. package/src/go/naming.ts +5 -17
  24. package/src/index.ts +1 -0
  25. package/src/kotlin/client.ts +53 -0
  26. package/src/kotlin/enums.ts +162 -0
  27. package/src/kotlin/index.ts +92 -0
  28. package/src/kotlin/manifest.ts +55 -0
  29. package/src/kotlin/models.ts +395 -0
  30. package/src/kotlin/naming.ts +223 -0
  31. package/src/kotlin/overrides.ts +25 -0
  32. package/src/kotlin/resources.ts +667 -0
  33. package/src/kotlin/tests.ts +1019 -0
  34. package/src/kotlin/type-map.ts +123 -0
  35. package/src/kotlin/wrappers.ts +168 -0
  36. package/src/node/client.ts +50 -0
  37. package/src/node/index.ts +1 -0
  38. package/src/node/resources.ts +164 -44
  39. package/src/node/tests.ts +37 -7
  40. package/src/php/client.ts +11 -3
  41. package/src/php/naming.ts +2 -21
  42. package/src/php/resources.ts +81 -6
  43. package/src/php/tests.ts +93 -17
  44. package/src/php/wrappers.ts +1 -0
  45. package/src/python/client.ts +37 -29
  46. package/src/python/enums.ts +7 -7
  47. package/src/python/models.ts +1 -1
  48. package/src/python/naming.ts +2 -22
  49. package/src/shared/model-utils.ts +232 -15
  50. package/src/shared/naming-utils.ts +47 -0
  51. package/src/shared/wrapper-utils.ts +12 -1
  52. package/test/dotnet/client.test.ts +121 -0
  53. package/test/dotnet/enums.test.ts +193 -0
  54. package/test/dotnet/errors.test.ts +9 -0
  55. package/test/dotnet/manifest.test.ts +82 -0
  56. package/test/dotnet/models.test.ts +260 -0
  57. package/test/dotnet/resources.test.ts +255 -0
  58. package/test/dotnet/tests.test.ts +202 -0
  59. package/test/kotlin/models.test.ts +135 -0
  60. package/test/kotlin/tests.test.ts +176 -0
  61. package/test/node/client.test.ts +74 -0
  62. package/test/node/resources.test.ts +216 -15
  63. package/test/php/client.test.ts +2 -1
  64. package/test/php/resources.test.ts +38 -0
  65. package/test/php/tests.test.ts +67 -0
@@ -106,6 +106,73 @@ describe('generateTests', () => {
106
106
  expect(resourceTest!.content).toContain('foreach ($result as $item)');
107
107
  });
108
108
 
109
+ it('generates redirect endpoint test with query param assertions', () => {
110
+ const ssoServices: Service[] = [
111
+ {
112
+ name: 'SSO',
113
+ operations: [
114
+ {
115
+ name: 'getAuthorizationUrl',
116
+ httpMethod: 'get',
117
+ path: '/sso/authorize',
118
+ pathParams: [],
119
+ queryParams: [
120
+ { name: 'client_id', type: { kind: 'primitive', type: 'string' }, required: true },
121
+ { name: 'response_type', type: { kind: 'primitive', type: 'string' }, required: true },
122
+ { name: 'redirect_uri', type: { kind: 'primitive', type: 'string' }, required: true },
123
+ { name: 'state', type: { kind: 'primitive', type: 'string' }, required: false },
124
+ ],
125
+ headerParams: [],
126
+ response: { kind: 'primitive', type: 'unknown' },
127
+ errors: [],
128
+ injectIdempotencyKey: false,
129
+ },
130
+ ],
131
+ },
132
+ ];
133
+
134
+ const ssoSpec = { ...spec, services: ssoServices };
135
+ const ssoCtx: EmitterContext = {
136
+ ...ctx,
137
+ spec: ssoSpec,
138
+ resolvedOperations: [
139
+ {
140
+ operation: ssoServices[0].operations[0],
141
+ service: ssoServices[0],
142
+ methodName: 'get_authorization_url',
143
+ mountOn: 'SSO',
144
+ defaults: { response_type: 'code' },
145
+ inferFromClient: ['client_id'],
146
+ } as any,
147
+ ],
148
+ };
149
+
150
+ const result = generateTests(ssoSpec, ssoCtx);
151
+ const testFile = result.find((f) => f.path === 'tests/Service/SSOTest.php');
152
+ expect(testFile).toBeDefined();
153
+ const content = testFile!.content;
154
+
155
+ // Should be a redirect endpoint test (no mock responses, returns string)
156
+ expect(content).toContain('$this->assertIsString($result)');
157
+ expect(content).toContain("assertStringContainsString('sso/authorize'");
158
+
159
+ // Should parse query params from URL
160
+ expect(content).toContain('parse_str(parse_url($result, PHP_URL_QUERY)');
161
+
162
+ // Should assert visible query params (required and optional)
163
+ expect(content).toContain("assertSame('test_value', $query['redirect_uri'])");
164
+ expect(content).toContain("assertSame('test_value', $query['state'])");
165
+
166
+ // Should pass optional params in the method call
167
+ expect(content).toContain("state: 'test_value'");
168
+
169
+ // Should assert hidden defaults
170
+ expect(content).toContain("assertSame('code', $query['response_type'])");
171
+
172
+ // Should assert inferred client fields
173
+ expect(content).toContain("assertArrayHasKey('client_id', $query)");
174
+ });
175
+
109
176
  it('generates fixture JSON files', () => {
110
177
  const result = generateTests(spec, ctx);
111
178