Skip to content

Commit

Permalink
Update openapi-generator to 7.6. (#3905)
Browse files Browse the repository at this point in the history
This removes a circular import and should let us remove the xsrfMiddleware (#3641).
  • Loading branch information
jyasskin committed May 23, 2024
1 parent 4422f17 commit 17685db
Show file tree
Hide file tree
Showing 33 changed files with 408 additions and 506 deletions.
2 changes: 1 addition & 1 deletion gen/js/chromestatus-openapi/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.2.0
7.6.0
5 changes: 3 additions & 2 deletions gen/js/chromestatus-openapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Module system
* CommonJS
* ES6 module system

It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html))
It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html))

### Building

Expand All @@ -27,7 +27,7 @@ npm run build

### Publishing

First build the package then run ```npm publish```
First build the package then run `npm publish`

### Consuming

Expand All @@ -43,3 +43,4 @@ _unPublished (not recommended):_

```
npm install PATH_TO_GENERATED_PACKAGE --save
```
77 changes: 49 additions & 28 deletions gen/js/chromestatus-openapi/src/apis/DefaultApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,18 @@ export class DefaultApi extends runtime.BaseAPI implements DefaultApiInterface {
* Add a user to a component
*/
async addUserToComponentRaw(requestParameters: AddUserToComponentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.componentId === null || requestParameters.componentId === undefined) {
throw new runtime.RequiredError('componentId','Required parameter requestParameters.componentId was null or undefined when calling addUserToComponent.');
if (requestParameters['componentId'] == null) {
throw new runtime.RequiredError(
'componentId',
'Required parameter "componentId" was null or undefined when calling addUserToComponent().'
);
}

if (requestParameters.userId === null || requestParameters.userId === undefined) {
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling addUserToComponent.');
if (requestParameters['userId'] == null) {
throw new runtime.RequiredError(
'userId',
'Required parameter "userId" was null or undefined when calling addUserToComponent().'
);
}

const queryParameters: any = {};
Expand All @@ -203,15 +209,15 @@ export class DefaultApi extends runtime.BaseAPI implements DefaultApiInterface {
headerParameters['Content-Type'] = 'application/json';

if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Xsrf-Token"] = this.configuration.apiKey("X-Xsrf-Token"); // XsrfToken authentication
headerParameters["X-Xsrf-Token"] = await this.configuration.apiKey("X-Xsrf-Token"); // XsrfToken authentication
}

const response = await this.request({
path: `/components/{componentId}/users/{userId}`.replace(`{${"componentId"}}`, encodeURIComponent(String(requestParameters.componentId))).replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))),
path: `/components/{componentId}/users/{userId}`.replace(`{${"componentId"}}`, encodeURIComponent(String(requestParameters['componentId']))).replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters['userId']))),
method: 'PUT',
headers: headerParameters,
query: queryParameters,
body: ComponentUsersRequestToJSON(requestParameters.componentUsersRequest),
body: ComponentUsersRequestToJSON(requestParameters['componentUsersRequest']),
}, initOverrides);

return new runtime.VoidApiResponse(response);
Expand All @@ -233,7 +239,7 @@ export class DefaultApi extends runtime.BaseAPI implements DefaultApiInterface {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Xsrf-Token"] = this.configuration.apiKey("X-Xsrf-Token"); // XsrfToken authentication
headerParameters["X-Xsrf-Token"] = await this.configuration.apiKey("X-Xsrf-Token"); // XsrfToken authentication
}

const response = await this.request({
Expand All @@ -258,16 +264,19 @@ export class DefaultApi extends runtime.BaseAPI implements DefaultApiInterface {
* List features whose external reviews are incomplete
*/
async listExternalReviewsRaw(requestParameters: ListExternalReviewsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ExternalReviewsResponse>> {
if (requestParameters.reviewGroup === null || requestParameters.reviewGroup === undefined) {
throw new runtime.RequiredError('reviewGroup','Required parameter requestParameters.reviewGroup was null or undefined when calling listExternalReviews.');
if (requestParameters['reviewGroup'] == null) {
throw new runtime.RequiredError(
'reviewGroup',
'Required parameter "reviewGroup" was null or undefined when calling listExternalReviews().'
);
}

const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

const response = await this.request({
path: `/external_reviews/{review_group}`.replace(`{${"review_group"}}`, encodeURIComponent(String(requestParameters.reviewGroup))),
path: `/external_reviews/{review_group}`.replace(`{${"review_group"}}`, encodeURIComponent(String(requestParameters['reviewGroup']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
Expand All @@ -288,22 +297,28 @@ export class DefaultApi extends runtime.BaseAPI implements DefaultApiInterface {
* List how long each feature took to launch
*/
async listFeatureLatencyRaw(requestParameters: ListFeatureLatencyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<FeatureLatency>>> {
if (requestParameters.startAt === null || requestParameters.startAt === undefined) {
throw new runtime.RequiredError('startAt','Required parameter requestParameters.startAt was null or undefined when calling listFeatureLatency.');
if (requestParameters['startAt'] == null) {
throw new runtime.RequiredError(
'startAt',
'Required parameter "startAt" was null or undefined when calling listFeatureLatency().'
);
}

if (requestParameters.endAt === null || requestParameters.endAt === undefined) {
throw new runtime.RequiredError('endAt','Required parameter requestParameters.endAt was null or undefined when calling listFeatureLatency.');
if (requestParameters['endAt'] == null) {
throw new runtime.RequiredError(
'endAt',
'Required parameter "endAt" was null or undefined when calling listFeatureLatency().'
);
}

const queryParameters: any = {};

if (requestParameters.startAt !== undefined) {
queryParameters['startAt'] = (requestParameters.startAt as any).toISOString().substring(0,10);
if (requestParameters['startAt'] != null) {
queryParameters['startAt'] = (requestParameters['startAt'] as any).toISOString().substring(0,10);
}

if (requestParameters.endAt !== undefined) {
queryParameters['endAt'] = (requestParameters.endAt as any).toISOString().substring(0,10);
if (requestParameters['endAt'] != null) {
queryParameters['endAt'] = (requestParameters['endAt'] as any).toISOString().substring(0,10);
}

const headerParameters: runtime.HTTPHeaders = {};
Expand Down Expand Up @@ -358,8 +373,8 @@ export class DefaultApi extends runtime.BaseAPI implements DefaultApiInterface {
async listSpecMentorsRaw(requestParameters: ListSpecMentorsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<SpecMentor>>> {
const queryParameters: any = {};

if (requestParameters.after !== undefined) {
queryParameters['after'] = (requestParameters.after as any).toISOString().substring(0,10);
if (requestParameters['after'] != null) {
queryParameters['after'] = (requestParameters['after'] as any).toISOString().substring(0,10);
}

const headerParameters: runtime.HTTPHeaders = {};
Expand All @@ -386,12 +401,18 @@ export class DefaultApi extends runtime.BaseAPI implements DefaultApiInterface {
* Remove a user from a component
*/
async removeUserFromComponentRaw(requestParameters: RemoveUserFromComponentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.componentId === null || requestParameters.componentId === undefined) {
throw new runtime.RequiredError('componentId','Required parameter requestParameters.componentId was null or undefined when calling removeUserFromComponent.');
if (requestParameters['componentId'] == null) {
throw new runtime.RequiredError(
'componentId',
'Required parameter "componentId" was null or undefined when calling removeUserFromComponent().'
);
}

if (requestParameters.userId === null || requestParameters.userId === undefined) {
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling removeUserFromComponent.');
if (requestParameters['userId'] == null) {
throw new runtime.RequiredError(
'userId',
'Required parameter "userId" was null or undefined when calling removeUserFromComponent().'
);
}

const queryParameters: any = {};
Expand All @@ -401,15 +422,15 @@ export class DefaultApi extends runtime.BaseAPI implements DefaultApiInterface {
headerParameters['Content-Type'] = 'application/json';

if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Xsrf-Token"] = this.configuration.apiKey("X-Xsrf-Token"); // XsrfToken authentication
headerParameters["X-Xsrf-Token"] = await this.configuration.apiKey("X-Xsrf-Token"); // XsrfToken authentication
}

const response = await this.request({
path: `/components/{componentId}/users/{userId}`.replace(`{${"componentId"}}`, encodeURIComponent(String(requestParameters.componentId))).replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))),
path: `/components/{componentId}/users/{userId}`.replace(`{${"componentId"}}`, encodeURIComponent(String(requestParameters['componentId']))).replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters['userId']))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
body: ComponentUsersRequestToJSON(requestParameters.componentUsersRequest),
body: ComponentUsersRequestToJSON(requestParameters['componentUsersRequest']),
}, initOverrides);

return new runtime.VoidApiResponse(response);
Expand Down
21 changes: 8 additions & 13 deletions gen/js/chromestatus-openapi/src/models/ComponentUsersRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
import { mapValues } from '../runtime';
/**
* Traits about the user in relation to the component
* @export
Expand All @@ -30,36 +30,31 @@ export interface ComponentUsersRequest {
/**
* Check if a given object implements the ComponentUsersRequest interface.
*/
export function instanceOfComponentUsersRequest(value: object): boolean {
let isInstance = true;

return isInstance;
export function instanceOfComponentUsersRequest(value: object): value is ComponentUsersRequest {
return true;
}

export function ComponentUsersRequestFromJSON(json: any): ComponentUsersRequest {
return ComponentUsersRequestFromJSONTyped(json, false);
}

export function ComponentUsersRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ComponentUsersRequest {
if ((json === undefined) || (json === null)) {
if (json == null) {
return json;
}
return {

'owner': !exists(json, 'owner') ? undefined : json['owner'],
'owner': json['owner'] == null ? undefined : json['owner'],
};
}

export function ComponentUsersRequestToJSON(value?: ComponentUsersRequest | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
if (value == null) {
return value;
}
return {

'owner': value.owner,
'owner': value['owner'],
};
}

29 changes: 12 additions & 17 deletions gen/js/chromestatus-openapi/src/models/ComponentsUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
import { mapValues } from '../runtime';
/**
*
* @export
Expand Down Expand Up @@ -42,21 +42,19 @@ export interface ComponentsUser {
/**
* Check if a given object implements the ComponentsUser interface.
*/
export function instanceOfComponentsUser(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "id" in value;
isInstance = isInstance && "name" in value;
isInstance = isInstance && "email" in value;

return isInstance;
export function instanceOfComponentsUser(value: object): value is ComponentsUser {
if (!('id' in value) || value['id'] === undefined) return false;
if (!('name' in value) || value['name'] === undefined) return false;
if (!('email' in value) || value['email'] === undefined) return false;
return true;
}

export function ComponentsUserFromJSON(json: any): ComponentsUser {
return ComponentsUserFromJSONTyped(json, false);
}

export function ComponentsUserFromJSONTyped(json: any, ignoreDiscriminator: boolean): ComponentsUser {
if ((json === undefined) || (json === null)) {
if (json == null) {
return json;
}
return {
Expand All @@ -68,17 +66,14 @@ export function ComponentsUserFromJSONTyped(json: any, ignoreDiscriminator: bool
}

export function ComponentsUserToJSON(value?: ComponentsUser | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
if (value == null) {
return value;
}
return {

'id': value.id,
'name': value.name,
'email': value.email,
'id': value['id'],
'name': value['name'],
'email': value['email'],
};
}

25 changes: 10 additions & 15 deletions gen/js/chromestatus-openapi/src/models/ComponentsUsersResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
import { mapValues } from '../runtime';
import type { ComponentsUser } from './ComponentsUser';
import {
ComponentsUserFromJSON,
Expand Down Expand Up @@ -49,38 +49,33 @@ export interface ComponentsUsersResponse {
/**
* Check if a given object implements the ComponentsUsersResponse interface.
*/
export function instanceOfComponentsUsersResponse(value: object): boolean {
let isInstance = true;

return isInstance;
export function instanceOfComponentsUsersResponse(value: object): value is ComponentsUsersResponse {
return true;
}

export function ComponentsUsersResponseFromJSON(json: any): ComponentsUsersResponse {
return ComponentsUsersResponseFromJSONTyped(json, false);
}

export function ComponentsUsersResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ComponentsUsersResponse {
if ((json === undefined) || (json === null)) {
if (json == null) {
return json;
}
return {

'users': !exists(json, 'users') ? undefined : ((json['users'] as Array<any>).map(ComponentsUserFromJSON)),
'components': !exists(json, 'components') ? undefined : ((json['components'] as Array<any>).map(OwnersAndSubscribersOfComponentFromJSON)),
'users': json['users'] == null ? undefined : ((json['users'] as Array<any>).map(ComponentsUserFromJSON)),
'components': json['components'] == null ? undefined : ((json['components'] as Array<any>).map(OwnersAndSubscribersOfComponentFromJSON)),
};
}

export function ComponentsUsersResponseToJSON(value?: ComponentsUsersResponse | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
if (value == null) {
return value;
}
return {

'users': value.users === undefined ? undefined : ((value.users as Array<any>).map(ComponentsUserToJSON)),
'components': value.components === undefined ? undefined : ((value.components as Array<any>).map(OwnersAndSubscribersOfComponentToJSON)),
'users': value['users'] == null ? undefined : ((value['users'] as Array<any>).map(ComponentsUserToJSON)),
'components': value['components'] == null ? undefined : ((value['components'] as Array<any>).map(OwnersAndSubscribersOfComponentToJSON)),
};
}

0 comments on commit 17685db

Please sign in to comment.