Skip to content

Commit ad64064

Browse files
zoo-github-actions-auth[bot]github-actions[bot]franknoirot
authored
Update api spec (#230)
* YOYO NEW API SPEC! * Separate out list of tests that are expected to fail * Generated new lib --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <[email protected]>
1 parent a7a6614 commit ad64064

File tree

5 files changed

+115
-56
lines changed

5 files changed

+115
-56
lines changed

__tests__/gen/unit-get_power_unit_conversion.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ async function example() {
1313

1414
describe('Testing unit.get_power_unit_conversion', () => {
1515
it('should be truthy or throw', async () => {
16-
expect(await example()).toBeTruthy();
16+
try {
17+
await example();
18+
} catch (err) {
19+
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
20+
}
1721
});
1822
});

spec.json

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19434,6 +19434,48 @@
1943419434
"type"
1943519435
]
1943619436
},
19437+
{
19438+
"description": "Mirror the input entities over the specified axis. (Currently only supports sketches)",
19439+
"type": "object",
19440+
"properties": {
19441+
"axis": {
19442+
"description": "Axis to use as mirror.",
19443+
"allOf": [
19444+
{
19445+
"$ref": "#/components/schemas/Point3d"
19446+
}
19447+
]
19448+
},
19449+
"ids": {
19450+
"description": "ID of the mirror entities.",
19451+
"type": "array",
19452+
"items": {
19453+
"type": "string",
19454+
"format": "uuid"
19455+
}
19456+
},
19457+
"point": {
19458+
"description": "Point through which the mirror axis passes.",
19459+
"allOf": [
19460+
{
19461+
"$ref": "#/components/schemas/Point3d"
19462+
}
19463+
]
19464+
},
19465+
"type": {
19466+
"type": "string",
19467+
"enum": [
19468+
"entity_mirror"
19469+
]
19470+
}
19471+
},
19472+
"required": [
19473+
"axis",
19474+
"ids",
19475+
"point",
19476+
"type"
19477+
]
19478+
},
1943719479
{
1943819480
"description": "Enter edit mode",
1943919481
"type": "object",
@@ -21338,8 +21380,8 @@
2133821380
"type": "object",
2133921381
"properties": {
2134021382
"object_ids": {
21341-
"nullable": true,
21342-
"description": "Which objects to fit to",
21383+
"description": "Which objects to fit camera to; if empty, fit to all non-default objects. Defaults to empty vector.",
21384+
"default": [],
2134321385
"type": "array",
2134421386
"items": {
2134521387
"type": "string",

src/apiGen.ts

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import fsp from 'node:fs/promises';
22
import { OpenAPIV3 } from 'openapi-types';
33
import { format } from 'prettier';
44
import pkg from 'fast-json-patch';
5+
import { testsExpectedToFail } from './expectedToFail';
56
const { observe, generate } = pkg;
67

78
export default async function apiGen(lookup: any) {
@@ -368,59 +369,7 @@ export default async function apiGen(lookup: any) {
368369
['{ api }', `{ ${safeTag} }`],
369370
['api.section', `${safeTag}.${operationId}`],
370371
]);
371-
if (
372-
// Tests that are expected to fail
373-
// They are not exactly ignored because we still hit the endpoint but might be rejected
374-
// because the dummy data in the tests is not valid
375-
// i.e. using a uuid like 000-000-....
376-
// The time spent making these all pass is not worth it because the endpoint already have tests
377-
// we mostly want to make sure the examples are valid aside from dummy data
378-
// or at the very least checked periodically.
379-
380-
// underscores before the period should be replaced with hyphens
381-
[
382-
'payments.delete_payment_information_for_user',
383-
'users.delete_user_self',
384-
'api-calls.get_api_call_for_user',
385-
'api-calls.get_async_operation',
386-
'payments.validate_customer_tax_information_for_user',
387-
'api-calls.get_api_call',
388-
'users.get_user_extended',
389-
'payments.delete_payment_method_for_user',
390-
'users.get_user',
391-
'oauth2.device_auth_verify',
392-
'users.get_user_front_hash_self',
393-
'oauth2.oauth2_provider_callback',
394-
'apps.apps_github_webhook',
395-
'meta.internal_get_api_token_for_discord_user',
396-
397-
// it's possible some of these org tests are failing because Kurt's account and token
398-
// used in these test are not in an org
399-
'payments.validate_customer_tax_information_for_org',
400-
'payments.list_payment_methods_for_org',
401-
'payments.list_invoices_for_org',
402-
'payments.get_payment_information_for_org',
403-
'payments.get_payment_balance_for_org',
404-
'payments.delete_payment_method_for_org',
405-
'payments.delete_payment_information_for_org',
406-
'payments.create_payment_intent_for_org',
407-
'orgs.get_user_org',
408-
'orgs.get_org_member',
409-
'orgs.get_org',
410-
'orgs.delete_org_member',
411-
'orgs.delete_org',
412-
'orgs.delete_org_saml_idp',
413-
'orgs.get_org_saml_idp',
414-
'payments.get_payment_balance_for_any_user',
415-
'payments.get_payment_balance_for_any_org',
416-
'service-accounts.create_service_account_for_org',
417-
'orgs.get_any_org',
418-
'payments.get_user_subscription',
419-
'users.get_user_privacy_settings',
420-
'payments.get_org_subscription',
421-
'orgs.get_org_privacy_settings',
422-
].includes(`${tag.trim()}.${operationId.trim()}`)
423-
) {
372+
if (testsExpectedToFail.includes(`${tag.trim()}.${operationId.trim()}`)) {
424373
// these test are expected to fail
425374
exampleTemplate = replacer(exampleTemplate, [
426375
['expect(await example()).toBeTruthy();', ''],

src/expectedToFail.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
export const testsExpectedToFail =
2+
// Tests that are expected to fail
3+
// They are not exactly ignored because we still hit the endpoint but might be rejected
4+
// because the dummy data in the tests is not valid
5+
// i.e. using a uuid like 000-000-....
6+
// The time spent making these all pass is not worth it because the endpoint already have tests
7+
// we mostly want to make sure the examples are valid aside from dummy data
8+
// or at the very least checked periodically.
9+
10+
// underscores before the period should be replaced with hyphens
11+
[
12+
'api-calls.get_api_call_for_user',
13+
'api-calls.get_api_call',
14+
'api-calls.get_async_operation',
15+
'apps.apps_github_webhook',
16+
'meta.internal_get_api_token_for_discord_user',
17+
'oauth2.device_auth_verify',
18+
'oauth2.oauth2_provider_callback',
19+
'payments-get_payment_balance_for_user',
20+
'payments.delete_payment_information_for_user',
21+
'payments.delete_payment_method_for_user',
22+
'payments.validate_customer_tax_information_for_user',
23+
'unit-get_frequency_unit_conversion',
24+
'unit.get_power_unit_conversion',
25+
'users.delete_user_self',
26+
'users.get_user_extended',
27+
'users.get_user_front_hash_self',
28+
'users.get_user',
29+
30+
// it's possible some of these org tests are failing because Kurt's account and token
31+
// used in these test are not in an org
32+
'orgs.delete_org_member',
33+
'orgs.delete_org_saml_idp',
34+
'orgs.delete_org',
35+
'orgs.get_any_org',
36+
'orgs.get_org_member',
37+
'orgs.get_org_privacy_settings',
38+
'orgs.get_org_saml_idp',
39+
'orgs.get_org',
40+
'orgs.get_user_org',
41+
'payments.create_payment_intent_for_org',
42+
'payments.delete_payment_information_for_org',
43+
'payments.delete_payment_method_for_org',
44+
'payments.get_org_subscription',
45+
'payments.get_payment_balance_for_any_org',
46+
'payments.get_payment_balance_for_any_user',
47+
'payments.get_payment_balance_for_org',
48+
'payments.get_payment_information_for_org',
49+
'payments.get_user_subscription',
50+
'payments.list_invoices_for_org',
51+
'payments.list_payment_methods_for_org',
52+
'payments.validate_customer_tax_information_for_org',
53+
'service-accounts.create_service_account_for_org',
54+
'users.get_user_privacy_settings',
55+
];

src/models.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,6 +2225,15 @@ export type ModelingCmd_type =
22252225
start_angle: Angle_type /* Start angle (in degrees). */;
22262226
type: 'entity_make_helix';
22272227
}
2228+
| {
2229+
axis: Point3d_type /* Axis to use as mirror. */;
2230+
/*{
2231+
"format": "uuid"
2232+
}*/
2233+
ids: string[];
2234+
point: Point3d_type /* Point through which the mirror axis passes. */;
2235+
type: 'entity_mirror';
2236+
}
22282237
| {
22292238
/* format:uuid, description:The edit target */
22302239
target: string;

0 commit comments

Comments
 (0)