Skip to content

Commit

Permalink
query shouldn't be optional if there are any required params
Browse files Browse the repository at this point in the history
  • Loading branch information
david-crespo committed May 6, 2024
1 parent a3b9d1e commit aab6022
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
50 changes: 25 additions & 25 deletions oxide-api/src/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Probe>({
Expand All @@ -4247,7 +4247,7 @@ export class Api extends HttpClient {
{
path,
query,
}: { path: ProbeViewPathParams; query?: ProbeViewQueryParams },
}: { path: ProbeViewPathParams; query: ProbeViewQueryParams },
params: FetchParams = {},
) => {
return this.request<ProbeInfo>({
Expand All @@ -4264,7 +4264,7 @@ export class Api extends HttpClient {
{
path,
query,
}: { path: ProbeDeletePathParams; query?: ProbeDeleteQueryParams },
}: { path: ProbeDeletePathParams; query: ProbeDeleteQueryParams },
params: FetchParams = {},
) => {
return this.request<void>({
Expand Down Expand Up @@ -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<Disk>({
Expand Down Expand Up @@ -4531,7 +4531,7 @@ export class Api extends HttpClient {
{
query,
body,
}: { query?: FloatingIpCreateQueryParams; body: FloatingIpCreate },
}: { query: FloatingIpCreateQueryParams; body: FloatingIpCreate },
params: FetchParams = {},
) => {
return this.request<FloatingIp>({
Expand Down Expand Up @@ -4745,7 +4745,7 @@ export class Api extends HttpClient {
{
path,
query,
}: { path: ImageDemotePathParams; query?: ImageDemoteQueryParams },
}: { path: ImageDemotePathParams; query: ImageDemoteQueryParams },
params: FetchParams = {},
) => {
return this.request<Image>({
Expand Down Expand Up @@ -4793,7 +4793,7 @@ export class Api extends HttpClient {
{
query,
body,
}: { query?: InstanceCreateQueryParams; body: InstanceCreate },
}: { query: InstanceCreateQueryParams; body: InstanceCreate },
params: FetchParams = {},
) => {
return this.request<Instance>({
Expand Down Expand Up @@ -5252,7 +5252,7 @@ export class Api extends HttpClient {
query,
body,
}: {
query?: InstanceNetworkInterfaceCreateQueryParams;
query: InstanceNetworkInterfaceCreateQueryParams;
body: InstanceNetworkInterfaceCreate;
},
params: FetchParams = {},
Expand Down Expand Up @@ -5481,7 +5481,7 @@ export class Api extends HttpClient {
{
query,
body,
}: { query?: SnapshotCreateQueryParams; body: SnapshotCreate },
}: { query: SnapshotCreateQueryParams; body: SnapshotCreate },
params: FetchParams = {},
) => {
return this.request<Snapshot>({
Expand Down Expand Up @@ -5706,7 +5706,7 @@ export class Api extends HttpClient {
body,
}: {
path: NetworkingSwitchPortApplySettingsPathParams;
query?: NetworkingSwitchPortApplySettingsQueryParams;
query: NetworkingSwitchPortApplySettingsQueryParams;
body: SwitchPortApplySettings;
},
params: FetchParams = {},
Expand All @@ -5728,7 +5728,7 @@ export class Api extends HttpClient {
query,
}: {
path: NetworkingSwitchPortClearSettingsPathParams;
query?: NetworkingSwitchPortClearSettingsQueryParams;
query: NetworkingSwitchPortClearSettingsQueryParams;
},
params: FetchParams = {},
) => {
Expand Down Expand Up @@ -5787,7 +5787,7 @@ export class Api extends HttpClient {
{
query,
body,
}: { query?: LocalIdpUserCreateQueryParams; body: UserCreate },
}: { query: LocalIdpUserCreateQueryParams; body: UserCreate },
params: FetchParams = {},
) => {
return this.request<User>({
Expand All @@ -5807,7 +5807,7 @@ export class Api extends HttpClient {
query,
}: {
path: LocalIdpUserDeletePathParams;
query?: LocalIdpUserDeleteQueryParams;
query: LocalIdpUserDeleteQueryParams;
},
params: FetchParams = {},
) => {
Expand All @@ -5828,7 +5828,7 @@ export class Api extends HttpClient {
body,
}: {
path: LocalIdpUserSetPasswordPathParams;
query?: LocalIdpUserSetPasswordQueryParams;
query: LocalIdpUserSetPasswordQueryParams;
body: UserPassword;
},
params: FetchParams = {},
Expand All @@ -5849,7 +5849,7 @@ export class Api extends HttpClient {
query,
body,
}: {
query?: SamlIdentityProviderCreateQueryParams;
query: SamlIdentityProviderCreateQueryParams;
body: SamlIdentityProviderCreate;
},
params: FetchParams = {},
Expand All @@ -5871,7 +5871,7 @@ export class Api extends HttpClient {
query,
}: {
path: SamlIdentityProviderViewPathParams;
query?: SamlIdentityProviderViewQueryParams;
query: SamlIdentityProviderViewQueryParams;
},
params: FetchParams = {},
) => {
Expand Down Expand Up @@ -6259,7 +6259,7 @@ export class Api extends HttpClient {
* Delete BGP configuration
*/
networkingBgpConfigDelete: (
{ query }: { query?: NetworkingBgpConfigDeleteQueryParams },
{ query }: { query: NetworkingBgpConfigDeleteQueryParams },
params: FetchParams = {},
) => {
return this.request<void>({
Expand All @@ -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<BgpAnnouncement[]>({
Expand Down Expand Up @@ -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<void>({
Expand All @@ -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<BgpImportedRouteIpv4[]>({
Expand Down Expand Up @@ -6645,7 +6645,7 @@ export class Api extends HttpClient {
{
path,
query,
}: { path: SiloUserViewPathParams; query?: SiloUserViewQueryParams },
}: { path: SiloUserViewPathParams; query: SiloUserViewQueryParams },
params: FetchParams = {},
) => {
return this.request<User>({
Expand Down Expand Up @@ -6737,7 +6737,7 @@ export class Api extends HttpClient {
* List firewall rules
*/
vpcFirewallRulesView: (
{ query }: { query?: VpcFirewallRulesViewQueryParams },
{ query }: { query: VpcFirewallRulesViewQueryParams },
params: FetchParams = {},
) => {
return this.request<VpcFirewallRules>({
Expand All @@ -6755,7 +6755,7 @@ export class Api extends HttpClient {
query,
body,
}: {
query?: VpcFirewallRulesUpdateQueryParams;
query: VpcFirewallRulesUpdateQueryParams;
body: VpcFirewallRuleUpdateParams;
},
params: FetchParams = {},
Expand Down Expand Up @@ -6789,7 +6789,7 @@ export class Api extends HttpClient {
{
query,
body,
}: { query?: VpcSubnetCreateQueryParams; body: VpcSubnetCreate },
}: { query: VpcSubnetCreateQueryParams; body: VpcSubnetCreate },
params: FetchParams = {},
) => {
return this.request<VpcSubnet>({
Expand Down Expand Up @@ -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<Vpc>({
Expand Down
4 changes: 3 additions & 1 deletion oxide-openapi-gen-ts/src/client/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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("},");
Expand Down

0 comments on commit aab6022

Please sign in to comment.