diff --git a/gen/js/chromestatus-openapi/.openapi-generator/VERSION b/gen/js/chromestatus-openapi/.openapi-generator/VERSION index c0be8a79..4b49d9bb 100644 --- a/gen/js/chromestatus-openapi/.openapi-generator/VERSION +++ b/gen/js/chromestatus-openapi/.openapi-generator/VERSION @@ -1 +1 @@ -6.4.0 \ No newline at end of file +7.2.0 \ No newline at end of file diff --git a/gen/js/chromestatus-openapi/src/apis/DefaultApi.ts b/gen/js/chromestatus-openapi/src/apis/DefaultApi.ts index 77c073ea..a032d437 100644 --- a/gen/js/chromestatus-openapi/src/apis/DefaultApi.ts +++ b/gen/js/chromestatus-openapi/src/apis/DefaultApi.ts @@ -17,13 +17,13 @@ import * as runtime from '../runtime'; import type { ComponentUsersRequest, ComponentsUsersResponse, -} from '../models'; +} from '../models/index'; import { ComponentUsersRequestFromJSON, ComponentUsersRequestToJSON, ComponentsUsersResponseFromJSON, ComponentsUsersResponseToJSON, -} from '../models'; +} from '../models/index'; export interface AddUserToComponentRequest { componentId: number; diff --git a/gen/js/chromestatus-openapi/src/index.ts b/gen/js/chromestatus-openapi/src/index.ts index be9d1ede..bebe8bbb 100644 --- a/gen/js/chromestatus-openapi/src/index.ts +++ b/gen/js/chromestatus-openapi/src/index.ts @@ -1,5 +1,5 @@ /* tslint:disable */ /* eslint-disable */ export * from './runtime'; -export * from './apis'; -export * from './models'; +export * from './apis/index'; +export * from './models/index'; diff --git a/gen/js/chromestatus-openapi/src/runtime.ts b/gen/js/chromestatus-openapi/src/runtime.ts index a34b99d2..776e2e63 100644 --- a/gen/js/chromestatus-openapi/src/runtime.ts +++ b/gen/js/chromestatus-openapi/src/runtime.ts @@ -91,6 +91,7 @@ export const DefaultConfig = new Configuration(); */ export class BaseAPI { + private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i'); private middleware: Middleware[]; constructor(protected configuration = DefaultConfig) { @@ -113,6 +114,23 @@ export class BaseAPI { return this.withMiddleware(...middlewares); } + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + protected isJsonMime(mime: string | null | undefined): boolean { + if (!mime) { + return false; + } + return BaseAPI.jsonRegex.test(mime); + } + protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise { const { url, init } = await this.createFetchParams(context, initOverrides); const response = await this.fetchApi(url, init); @@ -154,14 +172,20 @@ export class BaseAPI { })) }; + let body: any; + if (isFormData(overriddenInit.body) + || (overriddenInit.body instanceof URLSearchParams) + || isBlob(overriddenInit.body)) { + body = overriddenInit.body; + } else if (this.isJsonMime(headers['Content-Type'])) { + body = JSON.stringify(overriddenInit.body); + } else { + body = overriddenInit.body; + } + const init: RequestInit = { ...overriddenInit, - body: - isFormData(overriddenInit.body) || - overriddenInit.body instanceof URLSearchParams || - isBlob(overriddenInit.body) - ? overriddenInit.body - : JSON.stringify(overriddenInit.body), + body }; return { url, init }; diff --git a/gen/py/chromestatus_openapi/.openapi-generator/FILES b/gen/py/chromestatus_openapi/.openapi-generator/FILES index e54e8fed..2bad1520 100644 --- a/gen/py/chromestatus_openapi/.openapi-generator/FILES +++ b/gen/py/chromestatus_openapi/.openapi-generator/FILES @@ -8,10 +8,10 @@ chromestatus_openapi/__init__.py chromestatus_openapi/__main__.py chromestatus_openapi/controllers/__init__.py chromestatus_openapi/controllers/default_controller.py -chromestatus_openapi/controllers/security_controller_.py +chromestatus_openapi/controllers/security_controller.py chromestatus_openapi/encoder.py chromestatus_openapi/models/__init__.py -chromestatus_openapi/models/base_model_.py +chromestatus_openapi/models/base_model.py chromestatus_openapi/models/component_users_request.py chromestatus_openapi/models/components_user.py chromestatus_openapi/models/components_users_response.py diff --git a/gen/py/chromestatus_openapi/.openapi-generator/VERSION b/gen/py/chromestatus_openapi/.openapi-generator/VERSION index c0be8a79..4b49d9bb 100644 --- a/gen/py/chromestatus_openapi/.openapi-generator/VERSION +++ b/gen/py/chromestatus_openapi/.openapi-generator/VERSION @@ -1 +1 @@ -6.4.0 \ No newline at end of file +7.2.0 \ No newline at end of file diff --git a/gen/py/chromestatus_openapi/chromestatus_openapi/controllers/default_controller.py b/gen/py/chromestatus_openapi/chromestatus_openapi/controllers/default_controller.py index d538a5c4..81136d47 100644 --- a/gen/py/chromestatus_openapi/chromestatus_openapi/controllers/default_controller.py +++ b/gen/py/chromestatus_openapi/chromestatus_openapi/controllers/default_controller.py @@ -1,5 +1,4 @@ import connexion -import six from typing import Dict from typing import Tuple from typing import Union diff --git a/gen/py/chromestatus_openapi/chromestatus_openapi/controllers/security_controller_.py b/gen/py/chromestatus_openapi/chromestatus_openapi/controllers/security_controller.py similarity index 100% rename from gen/py/chromestatus_openapi/chromestatus_openapi/controllers/security_controller_.py rename to gen/py/chromestatus_openapi/chromestatus_openapi/controllers/security_controller.py diff --git a/gen/py/chromestatus_openapi/chromestatus_openapi/encoder.py b/gen/py/chromestatus_openapi/chromestatus_openapi/encoder.py index 2057c51d..700e9303 100644 --- a/gen/py/chromestatus_openapi/chromestatus_openapi/encoder.py +++ b/gen/py/chromestatus_openapi/chromestatus_openapi/encoder.py @@ -1,7 +1,6 @@ from connexion.apps.flask_app import FlaskJSONEncoder -import six -from chromestatus_openapi.models.base_model_ import Model +from chromestatus_openapi.models.base_model import Model class JSONEncoder(FlaskJSONEncoder): @@ -10,7 +9,7 @@ class JSONEncoder(FlaskJSONEncoder): def default(self, o): if isinstance(o, Model): dikt = {} - for attr, _ in six.iteritems(o.openapi_types): + for attr in o.openapi_types: value = getattr(o, attr) if value is None and not self.include_nulls: continue diff --git a/gen/py/chromestatus_openapi/chromestatus_openapi/models/__init__.py b/gen/py/chromestatus_openapi/chromestatus_openapi/models/__init__.py index 1219d6e6..17c1933f 100644 --- a/gen/py/chromestatus_openapi/chromestatus_openapi/models/__init__.py +++ b/gen/py/chromestatus_openapi/chromestatus_openapi/models/__init__.py @@ -1,7 +1,4 @@ -# coding: utf-8 - # flake8: noqa -from __future__ import absolute_import # import models into model package from chromestatus_openapi.models.component_users_request import ComponentUsersRequest from chromestatus_openapi.models.components_user import ComponentsUser diff --git a/gen/py/chromestatus_openapi/chromestatus_openapi/models/base_model_.py b/gen/py/chromestatus_openapi/chromestatus_openapi/models/base_model.py similarity index 95% rename from gen/py/chromestatus_openapi/chromestatus_openapi/models/base_model_.py rename to gen/py/chromestatus_openapi/chromestatus_openapi/models/base_model.py index f17c1c62..021bb9db 100644 --- a/gen/py/chromestatus_openapi/chromestatus_openapi/models/base_model_.py +++ b/gen/py/chromestatus_openapi/chromestatus_openapi/models/base_model.py @@ -1,6 +1,5 @@ import pprint -import six import typing from chromestatus_openapi import util @@ -8,7 +7,7 @@ from chromestatus_openapi import util T = typing.TypeVar('T') -class Model(object): +class Model: # openapiTypes: The key is attribute name and the # value is attribute type. openapi_types: typing.Dict[str, type] = {} @@ -29,7 +28,7 @@ class Model(object): """ result = {} - for attr, _ in six.iteritems(self.openapi_types): + for attr in self.openapi_types: value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( diff --git a/gen/py/chromestatus_openapi/chromestatus_openapi/models/component_users_request.py b/gen/py/chromestatus_openapi/chromestatus_openapi/models/component_users_request.py index 1534cd1f..ef148170 100644 --- a/gen/py/chromestatus_openapi/chromestatus_openapi/models/component_users_request.py +++ b/gen/py/chromestatus_openapi/chromestatus_openapi/models/component_users_request.py @@ -1,11 +1,8 @@ -# coding: utf-8 - -from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 -from chromestatus_openapi.models.base_model_ import Model +from chromestatus_openapi.models.base_model import Model from chromestatus_openapi import util @@ -43,7 +40,7 @@ class ComponentUsersRequest(Model): return util.deserialize_model(dikt, cls) @property - def owner(self): + def owner(self) -> bool: """Gets the owner of this ComponentUsersRequest. Impacts this user's ownership. For PUT, add ownership. For DELETE, remove ownership. # noqa: E501 @@ -54,7 +51,7 @@ class ComponentUsersRequest(Model): return self._owner @owner.setter - def owner(self, owner): + def owner(self, owner: bool): """Sets the owner of this ComponentUsersRequest. Impacts this user's ownership. For PUT, add ownership. For DELETE, remove ownership. # noqa: E501 diff --git a/gen/py/chromestatus_openapi/chromestatus_openapi/models/components_user.py b/gen/py/chromestatus_openapi/chromestatus_openapi/models/components_user.py index 63db6e49..b351df65 100644 --- a/gen/py/chromestatus_openapi/chromestatus_openapi/models/components_user.py +++ b/gen/py/chromestatus_openapi/chromestatus_openapi/models/components_user.py @@ -1,11 +1,8 @@ -# coding: utf-8 - -from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 -from chromestatus_openapi.models.base_model_ import Model +from chromestatus_openapi.models.base_model import Model from chromestatus_openapi import util @@ -53,7 +50,7 @@ class ComponentsUser(Model): return util.deserialize_model(dikt, cls) @property - def id(self): + def id(self) -> int: """Gets the id of this ComponentsUser. @@ -63,7 +60,7 @@ class ComponentsUser(Model): return self._id @id.setter - def id(self, id): + def id(self, id: int): """Sets the id of this ComponentsUser. @@ -76,7 +73,7 @@ class ComponentsUser(Model): self._id = id @property - def name(self): + def name(self) -> str: """Gets the name of this ComponentsUser. @@ -86,7 +83,7 @@ class ComponentsUser(Model): return self._name @name.setter - def name(self, name): + def name(self, name: str): """Sets the name of this ComponentsUser. @@ -99,7 +96,7 @@ class ComponentsUser(Model): self._name = name @property - def email(self): + def email(self) -> str: """Gets the email of this ComponentsUser. @@ -109,7 +106,7 @@ class ComponentsUser(Model): return self._email @email.setter - def email(self, email): + def email(self, email: str): """Sets the email of this ComponentsUser. diff --git a/gen/py/chromestatus_openapi/chromestatus_openapi/models/components_users_response.py b/gen/py/chromestatus_openapi/chromestatus_openapi/models/components_users_response.py index e5a4e8cb..da75cc85 100644 --- a/gen/py/chromestatus_openapi/chromestatus_openapi/models/components_users_response.py +++ b/gen/py/chromestatus_openapi/chromestatus_openapi/models/components_users_response.py @@ -1,11 +1,8 @@ -# coding: utf-8 - -from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 -from chromestatus_openapi.models.base_model_ import Model +from chromestatus_openapi.models.base_model import Model from chromestatus_openapi.models.components_user import ComponentsUser from chromestatus_openapi.models.owners_and_subscribers_of_component import OwnersAndSubscribersOfComponent from chromestatus_openapi import util @@ -52,7 +49,7 @@ class ComponentsUsersResponse(Model): return util.deserialize_model(dikt, cls) @property - def users(self): + def users(self) -> List[ComponentsUser]: """Gets the users of this ComponentsUsersResponse. @@ -62,7 +59,7 @@ class ComponentsUsersResponse(Model): return self._users @users.setter - def users(self, users): + def users(self, users: List[ComponentsUser]): """Sets the users of this ComponentsUsersResponse. @@ -73,7 +70,7 @@ class ComponentsUsersResponse(Model): self._users = users @property - def components(self): + def components(self) -> List[OwnersAndSubscribersOfComponent]: """Gets the components of this ComponentsUsersResponse. @@ -83,7 +80,7 @@ class ComponentsUsersResponse(Model): return self._components @components.setter - def components(self, components): + def components(self, components: List[OwnersAndSubscribersOfComponent]): """Sets the components of this ComponentsUsersResponse. diff --git a/gen/py/chromestatus_openapi/chromestatus_openapi/models/owners_and_subscribers_of_component.py b/gen/py/chromestatus_openapi/chromestatus_openapi/models/owners_and_subscribers_of_component.py index f62dbb6a..81f40873 100644 --- a/gen/py/chromestatus_openapi/chromestatus_openapi/models/owners_and_subscribers_of_component.py +++ b/gen/py/chromestatus_openapi/chromestatus_openapi/models/owners_and_subscribers_of_component.py @@ -1,11 +1,8 @@ -# coding: utf-8 - -from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 -from chromestatus_openapi.models.base_model_ import Model +from chromestatus_openapi.models.base_model import Model from chromestatus_openapi import util @@ -58,7 +55,7 @@ class OwnersAndSubscribersOfComponent(Model): return util.deserialize_model(dikt, cls) @property - def id(self): + def id(self) -> str: """Gets the id of this OwnersAndSubscribersOfComponent. @@ -68,7 +65,7 @@ class OwnersAndSubscribersOfComponent(Model): return self._id @id.setter - def id(self, id): + def id(self, id: str): """Sets the id of this OwnersAndSubscribersOfComponent. @@ -81,7 +78,7 @@ class OwnersAndSubscribersOfComponent(Model): self._id = id @property - def name(self): + def name(self) -> str: """Gets the name of this OwnersAndSubscribersOfComponent. @@ -91,7 +88,7 @@ class OwnersAndSubscribersOfComponent(Model): return self._name @name.setter - def name(self, name): + def name(self, name: str): """Sets the name of this OwnersAndSubscribersOfComponent. @@ -104,7 +101,7 @@ class OwnersAndSubscribersOfComponent(Model): self._name = name @property - def subscriber_ids(self): + def subscriber_ids(self) -> List[int]: """Gets the subscriber_ids of this OwnersAndSubscribersOfComponent. @@ -114,7 +111,7 @@ class OwnersAndSubscribersOfComponent(Model): return self._subscriber_ids @subscriber_ids.setter - def subscriber_ids(self, subscriber_ids): + def subscriber_ids(self, subscriber_ids: List[int]): """Sets the subscriber_ids of this OwnersAndSubscribersOfComponent. @@ -125,7 +122,7 @@ class OwnersAndSubscribersOfComponent(Model): self._subscriber_ids = subscriber_ids @property - def owner_ids(self): + def owner_ids(self) -> List[int]: """Gets the owner_ids of this OwnersAndSubscribersOfComponent. @@ -135,7 +132,7 @@ class OwnersAndSubscribersOfComponent(Model): return self._owner_ids @owner_ids.setter - def owner_ids(self, owner_ids): + def owner_ids(self, owner_ids: List[int]): """Sets the owner_ids of this OwnersAndSubscribersOfComponent. diff --git a/gen/py/chromestatus_openapi/chromestatus_openapi/test/test_default_controller.py b/gen/py/chromestatus_openapi/chromestatus_openapi/test/test_default_controller.py index c0ab60a7..259bc3cf 100644 --- a/gen/py/chromestatus_openapi/chromestatus_openapi/test/test_default_controller.py +++ b/gen/py/chromestatus_openapi/chromestatus_openapi/test/test_default_controller.py @@ -1,10 +1,6 @@ -# coding: utf-8 - -from __future__ import absolute_import import unittest from flask import json -from six import BytesIO from chromestatus_openapi.models.component_users_request import ComponentUsersRequest # noqa: E501 from chromestatus_openapi.models.components_users_response import ComponentsUsersResponse # noqa: E501 diff --git a/gen/py/chromestatus_openapi/chromestatus_openapi/typing_utils.py b/gen/py/chromestatus_openapi/chromestatus_openapi/typing_utils.py index 0563f81f..74e3c913 100644 --- a/gen/py/chromestatus_openapi/chromestatus_openapi/typing_utils.py +++ b/gen/py/chromestatus_openapi/chromestatus_openapi/typing_utils.py @@ -1,5 +1,3 @@ -# coding: utf-8 - import sys if sys.version_info < (3, 7): diff --git a/gen/py/chromestatus_openapi/chromestatus_openapi/util.py b/gen/py/chromestatus_openapi/chromestatus_openapi/util.py index 5a0608fb..5f9e29e9 100644 --- a/gen/py/chromestatus_openapi/chromestatus_openapi/util.py +++ b/gen/py/chromestatus_openapi/chromestatus_openapi/util.py @@ -1,6 +1,5 @@ import datetime -import six import typing from chromestatus_openapi import typing_utils @@ -16,7 +15,7 @@ def _deserialize(data, klass): if data is None: return None - if klass in six.integer_types or klass in (float, str, bool, bytearray): + if klass in (int, float, str, bool, bytearray): return _deserialize_primitive(data, klass) elif klass == object: return _deserialize_object(data) @@ -45,7 +44,7 @@ def _deserialize_primitive(data, klass): try: value = klass(data) except UnicodeEncodeError: - value = six.u(data) + value = data except TypeError: value = data return value @@ -110,7 +109,7 @@ def deserialize_model(data, klass): if not instance.openapi_types: return data - for attr, attr_type in six.iteritems(instance.openapi_types): + for attr, attr_type in instance.openapi_types.items(): if data is not None \ and instance.attribute_map[attr] in data \ and isinstance(data, (list, dict)): @@ -145,4 +144,4 @@ def _deserialize_dict(data, boxed_type): :rtype: dict """ return {k: _deserialize(v, boxed_type) - for k, v in six.iteritems(data)} + for k, v in data.items() } diff --git a/gen/py/chromestatus_openapi/setup.py b/gen/py/chromestatus_openapi/setup.py index cc971211..a978b0e3 100644 --- a/gen/py/chromestatus_openapi/setup.py +++ b/gen/py/chromestatus_openapi/setup.py @@ -1,5 +1,3 @@ -# coding: utf-8 - import sys from setuptools import setup, find_packages diff --git a/gen/py/chromestatus_openapi/tox.ini b/gen/py/chromestatus_openapi/tox.ini index 900b159f..db827d7b 100644 --- a/gen/py/chromestatus_openapi/tox.ini +++ b/gen/py/chromestatus_openapi/tox.ini @@ -5,7 +5,7 @@ skipsdist=True [testenv] deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt - {toxinidir} + {toxinidir} commands= pytest --cov=chromestatus_openapi diff --git a/openapitools.json b/openapitools.json index 04369381..e73b9758 100644 --- a/openapitools.json +++ b/openapitools.json @@ -2,6 +2,6 @@ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "6.4.0" + "version": "7.2.0" } } diff --git a/package-lock.json b/package-lock.json index 20225124..e69f0d3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -74,7 +74,20 @@ "gen/js/chromestatus-openapi": { "version": "1.0.0", "devDependencies": { - "typescript": "^5.3" + "typescript": "^4.0" + } + }, + "gen/js/chromestatus-openapi/node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" } }, "node_modules/@75lb/deep-merge": { @@ -19677,7 +19690,15 @@ "chromestatus-openapi": { "version": "file:gen/js/chromestatus-openapi", "requires": { - "typescript": "^5.3" + "typescript": "^4.0" + }, + "dependencies": { + "typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true + } } }, "chromium-bidi": {