Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make swagger-all #122

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.1
7.9.0
1 change: 1 addition & 0 deletions js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-g

- API version: 0.1
- Package version: 0.1
- Generator version: 7.9.0
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen

## Installation
Expand Down
2 changes: 1 addition & 1 deletion js/src/ApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class ApiClient {
url = apiBasePath + path;
}

url = url.replace(/\{([\w-\.]+)\}/g, (fullMatch, key) => {
url = url.replace(/\{([\w-\.#]+)\}/g, (fullMatch, key) => {
var value;
if (pathParams.hasOwnProperty(key)) {
value = this.paramToString(pathParams[key]);
Expand Down
2 changes: 1 addition & 1 deletion js/src/model/Director.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Director {
static validateJSON(data) {
// check to make sure all required properties are present in the JSON string
for (const property of Director.RequiredProperties) {
if (!data[property]) {
if (!data.hasOwnProperty(property)) {
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/src/model/DirectorFilmsInner.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class DirectorFilmsInner {
static validateJSON(data) {
// check to make sure all required properties are present in the JSON string
for (const property of DirectorFilmsInner.RequiredProperties) {
if (!data[property]) {
if (!data.hasOwnProperty(property)) {
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/src/model/DirectorFilmsInnerCountriesInner.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class DirectorFilmsInnerCountriesInner {
static validateJSON(data) {
// check to make sure all required properties are present in the JSON string
for (const property of DirectorFilmsInnerCountriesInner.RequiredProperties) {
if (!data[property]) {
if (!data.hasOwnProperty(property)) {
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/src/model/DirectorFilmsInnerOffersInner.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class DirectorFilmsInnerOffersInner {
static validateJSON(data) {
// check to make sure all required properties are present in the JSON string
for (const property of DirectorFilmsInnerOffersInner.RequiredProperties) {
if (!data[property]) {
if (!data.hasOwnProperty(property)) {
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/src/model/DirectorInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class DirectorInfo {
static validateJSON(data) {
// check to make sure all required properties are present in the JSON string
for (const property of DirectorInfo.RequiredProperties) {
if (!data[property]) {
if (!data.hasOwnProperty(property)) {
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/src/model/Film.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class Film {
static validateJSON(data) {
// check to make sure all required properties are present in the JSON string
for (const property of Film.RequiredProperties) {
if (!data[property]) {
if (!data.hasOwnProperty(property)) {
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def _get_kwargs(
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[List["ArrayOfDirectorsItem"]]:
if response.status_code == HTTPStatus.OK:
if response.status_code == 200:
response_200 = []
_response_200 = response.json()
for componentsschemas_array_of_directors_item_data in _response_200:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _get_kwargs(


def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Director]:
if response.status_code == HTTPStatus.OK:
if response.status_code == 200:
response_200 = Director.from_dict(response.json())

return response_200
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _get_kwargs(
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[List["ArrayOfFilmsItem"]]:
if response.status_code == HTTPStatus.OK:
if response.status_code == 200:
response_200 = []
_response_200 = response.json()
for componentsschemas_array_of_films_item_data in _response_200:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _get_kwargs(


def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Film]:
if response.status_code == HTTPStatus.OK:
if response.status_code == 200:
response_200 = Film.from_dict(response.json())

return response_200
Expand Down
4 changes: 2 additions & 2 deletions letsrolld-api-client/letsrolld_api_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def with_timeout(self, timeout: httpx.Timeout) -> "Client":
return evolve(self, timeout=timeout)

def set_httpx_client(self, client: httpx.Client) -> "Client":
"""Manually the underlying httpx.Client
"""Manually set the underlying httpx.Client

**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
"""
Expand Down Expand Up @@ -204,7 +204,7 @@ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
return evolve(self, timeout=timeout)

def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
"""Manually the underlying httpx.Client
"""Manually set the underlying httpx.Client

**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
"""
Expand Down
2 changes: 1 addition & 1 deletion ts/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.1
7.9.0
63 changes: 55 additions & 8 deletions ts/model/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ let typeMap: {[index: string]: any} = {
"Film": Film,
}

// Check if a string starts with another string without using es6 features
function startsWith(str: string, match: string): boolean {
return str.substring(0, match.length) === match;
}

// Check if a string ends with another string without using es6 features
function endsWith(str: string, match: string): boolean {
return str.length >= match.length && str.substring(str.length - match.length) === match;
}

const nullableSuffix = " | null";
const optionalSuffix = " | undefined";
const arrayPrefix = "Array<";
const arraySuffix = ">";
const mapPrefix = "{ [key: string]: ";
const mapSuffix = "; }";

export class ObjectSerializer {
public static findCorrectType(data: any, expectedType: string) {
if (data == undefined) {
Expand Down Expand Up @@ -93,20 +110,35 @@ export class ObjectSerializer {
}
}

public static serialize(data: any, type: string) {
public static serialize(data: any, type: string): any {
if (data == undefined) {
return data;
} else if (primitives.indexOf(type.toLowerCase()) !== -1) {
return data;
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type
} else if (endsWith(type, nullableSuffix)) {
let subType: string = type.slice(0, -nullableSuffix.length); // Type | null => Type
return ObjectSerializer.serialize(data, subType);
} else if (endsWith(type, optionalSuffix)) {
let subType: string = type.slice(0, -optionalSuffix.length); // Type | undefined => Type
return ObjectSerializer.serialize(data, subType);
} else if (startsWith(type, arrayPrefix)) {
let subType: string = type.slice(arrayPrefix.length, -arraySuffix.length); // Array<Type> => Type
let transformedData: any[] = [];
for (let index = 0; index < data.length; index++) {
let datum = data[index];
transformedData.push(ObjectSerializer.serialize(datum, subType));
}
return transformedData;
} else if (startsWith(type, mapPrefix)) {
let subType: string = type.slice(mapPrefix.length, -mapSuffix.length); // { [key: string]: Type; } => Type
let transformedData: { [key: string]: any } = {};
for (let key in data) {
transformedData[key] = ObjectSerializer.serialize(
data[key],
subType,
);
}
return transformedData;
} else if (type === "Date") {
return data.toISOString();
} else {
Expand All @@ -131,22 +163,37 @@ export class ObjectSerializer {
}
}

public static deserialize(data: any, type: string) {
public static deserialize(data: any, type: string): any {
// polymorphism may change the actual type.
type = ObjectSerializer.findCorrectType(data, type);
if (data == undefined) {
return data;
} else if (primitives.indexOf(type.toLowerCase()) !== -1) {
return data;
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type
} else if (endsWith(type, nullableSuffix)) {
let subType: string = type.slice(0, -nullableSuffix.length); // Type | null => Type
return ObjectSerializer.deserialize(data, subType);
} else if (endsWith(type, optionalSuffix)) {
let subType: string = type.slice(0, -optionalSuffix.length); // Type | undefined => Type
return ObjectSerializer.deserialize(data, subType);
} else if (startsWith(type, arrayPrefix)) {
let subType: string = type.slice(arrayPrefix.length, -arraySuffix.length); // Array<Type> => Type
let transformedData: any[] = [];
for (let index = 0; index < data.length; index++) {
let datum = data[index];
transformedData.push(ObjectSerializer.deserialize(datum, subType));
}
return transformedData;
} else if (startsWith(type, mapPrefix)) {
let subType: string = type.slice(mapPrefix.length, -mapSuffix.length); // { [key: string]: Type; } => Type
let transformedData: { [key: string]: any } = {};
for (let key in data) {
transformedData[key] = ObjectSerializer.deserialize(
data[key],
subType,
);
}
return transformedData;
} else if (type === "Date") {
return new Date(data);
} else {
Expand Down
Loading