@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.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +7 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3288 -791
- package/dist/index.mjs.map +1 -1
- package/docs/sdk-architecture/dotnet.md +336 -0
- package/oagen.config.ts +42 -12
- package/package.json +2 -2
- package/smoke/sdk-dotnet.ts +45 -12
- package/src/dotnet/client.ts +89 -0
- package/src/dotnet/enums.ts +323 -0
- package/src/dotnet/fixtures.ts +236 -0
- package/src/dotnet/index.ts +246 -0
- package/src/dotnet/manifest.ts +36 -0
- package/src/dotnet/models.ts +344 -0
- package/src/dotnet/naming.ts +330 -0
- package/src/dotnet/resources.ts +622 -0
- package/src/dotnet/tests.ts +693 -0
- package/src/dotnet/type-map.ts +201 -0
- package/src/dotnet/wrappers.ts +186 -0
- package/src/go/index.ts +5 -2
- package/src/go/naming.ts +5 -17
- package/src/index.ts +1 -0
- package/src/kotlin/client.ts +53 -0
- package/src/kotlin/enums.ts +162 -0
- package/src/kotlin/index.ts +92 -0
- package/src/kotlin/manifest.ts +55 -0
- package/src/kotlin/models.ts +395 -0
- package/src/kotlin/naming.ts +223 -0
- package/src/kotlin/overrides.ts +25 -0
- package/src/kotlin/resources.ts +667 -0
- package/src/kotlin/tests.ts +1019 -0
- package/src/kotlin/type-map.ts +123 -0
- package/src/kotlin/wrappers.ts +168 -0
- package/src/node/client.ts +50 -0
- package/src/node/index.ts +1 -0
- package/src/node/resources.ts +164 -44
- package/src/node/tests.ts +37 -7
- package/src/php/client.ts +11 -3
- package/src/php/naming.ts +2 -21
- package/src/php/resources.ts +81 -6
- package/src/php/tests.ts +93 -17
- package/src/php/wrappers.ts +1 -0
- package/src/python/client.ts +37 -29
- package/src/python/enums.ts +7 -7
- package/src/python/models.ts +1 -1
- package/src/python/naming.ts +2 -22
- package/src/shared/model-utils.ts +232 -15
- package/src/shared/naming-utils.ts +47 -0
- package/src/shared/wrapper-utils.ts +12 -1
- package/test/dotnet/client.test.ts +121 -0
- package/test/dotnet/enums.test.ts +193 -0
- package/test/dotnet/errors.test.ts +9 -0
- package/test/dotnet/manifest.test.ts +82 -0
- package/test/dotnet/models.test.ts +260 -0
- package/test/dotnet/resources.test.ts +255 -0
- package/test/dotnet/tests.test.ts +202 -0
- package/test/kotlin/models.test.ts +135 -0
- package/test/kotlin/tests.test.ts +176 -0
- package/test/node/client.test.ts +74 -0
- package/test/node/resources.test.ts +216 -15
- package/test/php/client.test.ts +2 -1
- package/test/php/resources.test.ts +38 -0
- package/test/php/tests.test.ts +67 -0
package/test/php/tests.test.ts
CHANGED
|
@@ -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
|
|