diff --git a/oxide-api/src/Api.ts b/oxide-api/src/Api.ts index 3d6f327..29ab67e 100644 --- a/oxide-api/src/Api.ts +++ b/oxide-api/src/Api.ts @@ -4229,7 +4229,7 @@ export class Api extends HttpClient { * Create instrumentation probe */ probeCreate: ( - { query, body }: { query?: ProbeCreateQueryParams; body: ProbeCreate }, + { query, body }: { query: ProbeCreateQueryParams; body: ProbeCreate }, params: FetchParams = {}, ) => { return this.request({ @@ -4247,7 +4247,7 @@ export class Api extends HttpClient { { path, query, - }: { path: ProbeViewPathParams; query?: ProbeViewQueryParams }, + }: { path: ProbeViewPathParams; query: ProbeViewQueryParams }, params: FetchParams = {}, ) => { return this.request({ @@ -4264,7 +4264,7 @@ export class Api extends HttpClient { { path, query, - }: { path: ProbeDeletePathParams; query?: ProbeDeleteQueryParams }, + }: { path: ProbeDeletePathParams; query: ProbeDeleteQueryParams }, params: FetchParams = {}, ) => { return this.request({ @@ -4359,7 +4359,7 @@ export class Api extends HttpClient { * Create a disk */ diskCreate: ( - { query, body }: { query?: DiskCreateQueryParams; body: DiskCreate }, + { query, body }: { query: DiskCreateQueryParams; body: DiskCreate }, params: FetchParams = {}, ) => { return this.request({ @@ -4531,7 +4531,7 @@ export class Api extends HttpClient { { query, body, - }: { query?: FloatingIpCreateQueryParams; body: FloatingIpCreate }, + }: { query: FloatingIpCreateQueryParams; body: FloatingIpCreate }, params: FetchParams = {}, ) => { return this.request({ @@ -4745,7 +4745,7 @@ export class Api extends HttpClient { { path, query, - }: { path: ImageDemotePathParams; query?: ImageDemoteQueryParams }, + }: { path: ImageDemotePathParams; query: ImageDemoteQueryParams }, params: FetchParams = {}, ) => { return this.request({ @@ -4793,7 +4793,7 @@ export class Api extends HttpClient { { query, body, - }: { query?: InstanceCreateQueryParams; body: InstanceCreate }, + }: { query: InstanceCreateQueryParams; body: InstanceCreate }, params: FetchParams = {}, ) => { return this.request({ @@ -5252,7 +5252,7 @@ export class Api extends HttpClient { query, body, }: { - query?: InstanceNetworkInterfaceCreateQueryParams; + query: InstanceNetworkInterfaceCreateQueryParams; body: InstanceNetworkInterfaceCreate; }, params: FetchParams = {}, @@ -5481,7 +5481,7 @@ export class Api extends HttpClient { { query, body, - }: { query?: SnapshotCreateQueryParams; body: SnapshotCreate }, + }: { query: SnapshotCreateQueryParams; body: SnapshotCreate }, params: FetchParams = {}, ) => { return this.request({ @@ -5706,7 +5706,7 @@ export class Api extends HttpClient { body, }: { path: NetworkingSwitchPortApplySettingsPathParams; - query?: NetworkingSwitchPortApplySettingsQueryParams; + query: NetworkingSwitchPortApplySettingsQueryParams; body: SwitchPortApplySettings; }, params: FetchParams = {}, @@ -5728,7 +5728,7 @@ export class Api extends HttpClient { query, }: { path: NetworkingSwitchPortClearSettingsPathParams; - query?: NetworkingSwitchPortClearSettingsQueryParams; + query: NetworkingSwitchPortClearSettingsQueryParams; }, params: FetchParams = {}, ) => { @@ -5787,7 +5787,7 @@ export class Api extends HttpClient { { query, body, - }: { query?: LocalIdpUserCreateQueryParams; body: UserCreate }, + }: { query: LocalIdpUserCreateQueryParams; body: UserCreate }, params: FetchParams = {}, ) => { return this.request({ @@ -5807,7 +5807,7 @@ export class Api extends HttpClient { query, }: { path: LocalIdpUserDeletePathParams; - query?: LocalIdpUserDeleteQueryParams; + query: LocalIdpUserDeleteQueryParams; }, params: FetchParams = {}, ) => { @@ -5828,7 +5828,7 @@ export class Api extends HttpClient { body, }: { path: LocalIdpUserSetPasswordPathParams; - query?: LocalIdpUserSetPasswordQueryParams; + query: LocalIdpUserSetPasswordQueryParams; body: UserPassword; }, params: FetchParams = {}, @@ -5849,7 +5849,7 @@ export class Api extends HttpClient { query, body, }: { - query?: SamlIdentityProviderCreateQueryParams; + query: SamlIdentityProviderCreateQueryParams; body: SamlIdentityProviderCreate; }, params: FetchParams = {}, @@ -5871,7 +5871,7 @@ export class Api extends HttpClient { query, }: { path: SamlIdentityProviderViewPathParams; - query?: SamlIdentityProviderViewQueryParams; + query: SamlIdentityProviderViewQueryParams; }, params: FetchParams = {}, ) => { @@ -6259,7 +6259,7 @@ export class Api extends HttpClient { * Delete BGP configuration */ networkingBgpConfigDelete: ( - { query }: { query?: NetworkingBgpConfigDeleteQueryParams }, + { query }: { query: NetworkingBgpConfigDeleteQueryParams }, params: FetchParams = {}, ) => { return this.request({ @@ -6273,7 +6273,7 @@ export class Api extends HttpClient { * Get originated routes for a BGP configuration */ networkingBgpAnnounceSetList: ( - { query }: { query?: NetworkingBgpAnnounceSetListQueryParams }, + { query }: { query: NetworkingBgpAnnounceSetListQueryParams }, params: FetchParams = {}, ) => { return this.request({ @@ -6301,7 +6301,7 @@ export class Api extends HttpClient { * Delete BGP announce set */ networkingBgpAnnounceSetDelete: ( - { query }: { query?: NetworkingBgpAnnounceSetDeleteQueryParams }, + { query }: { query: NetworkingBgpAnnounceSetDeleteQueryParams }, params: FetchParams = {}, ) => { return this.request({ @@ -6315,7 +6315,7 @@ export class Api extends HttpClient { * Get imported IPv4 BGP routes */ networkingBgpImportedRoutesIpv4: ( - { query }: { query?: NetworkingBgpImportedRoutesIpv4QueryParams }, + { query }: { query: NetworkingBgpImportedRoutesIpv4QueryParams }, params: FetchParams = {}, ) => { return this.request({ @@ -6645,7 +6645,7 @@ export class Api extends HttpClient { { path, query, - }: { path: SiloUserViewPathParams; query?: SiloUserViewQueryParams }, + }: { path: SiloUserViewPathParams; query: SiloUserViewQueryParams }, params: FetchParams = {}, ) => { return this.request({ @@ -6737,7 +6737,7 @@ export class Api extends HttpClient { * List firewall rules */ vpcFirewallRulesView: ( - { query }: { query?: VpcFirewallRulesViewQueryParams }, + { query }: { query: VpcFirewallRulesViewQueryParams }, params: FetchParams = {}, ) => { return this.request({ @@ -6755,7 +6755,7 @@ export class Api extends HttpClient { query, body, }: { - query?: VpcFirewallRulesUpdateQueryParams; + query: VpcFirewallRulesUpdateQueryParams; body: VpcFirewallRuleUpdateParams; }, params: FetchParams = {}, @@ -6789,7 +6789,7 @@ export class Api extends HttpClient { { query, body, - }: { query?: VpcSubnetCreateQueryParams; body: VpcSubnetCreate }, + }: { query: VpcSubnetCreateQueryParams; body: VpcSubnetCreate }, params: FetchParams = {}, ) => { return this.request({ @@ -6898,7 +6898,7 @@ export class Api extends HttpClient { * Create VPC */ vpcCreate: ( - { query, body }: { query?: VpcCreateQueryParams; body: VpcCreate }, + { query, body }: { query: VpcCreateQueryParams; body: VpcCreate }, params: FetchParams = {}, ) => { return this.request({ diff --git a/oxide-openapi-gen-ts/src/client/api.ts b/oxide-openapi-gen-ts/src/client/api.ts index 2e8377b..b9cdb6c 100644 --- a/oxide-openapi-gen-ts/src/client/api.ts +++ b/oxide-openapi-gen-ts/src/client/api.ts @@ -256,7 +256,9 @@ export function generateApi(spec: OpenAPIV3.Document, destDir: string) { } if (queryParams.length > 0) { - w(`query?: ${queryParamsType(methodNameType)},`); + w0("query"); + if (!queryParams.some((p) => p.required)) w0("?"); + w(`: ${queryParamsType(methodNameType)},`); } if (bodyType) w(`body: ${bodyType},`); w("},");