This commit is contained in:
Jeffrey Yasskin 2024-01-25 07:32:21 -08:00 коммит произвёл GitHub
Родитель fe936c92f6
Коммит 1d47ae224d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
22 изменённых файлов: 95 добавлений и 77 удалений

Просмотреть файл

@ -1 +1 @@
6.4.0
7.2.0

Просмотреть файл

@ -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;

Просмотреть файл

@ -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';

Просмотреть файл

@ -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<T>(...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<Response> {
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 };

Просмотреть файл

@ -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

Просмотреть файл

@ -1 +1 @@
6.4.0
7.2.0

Просмотреть файл

@ -1,5 +1,4 @@
import connexion
import six
from typing import Dict
from typing import Tuple
from typing import Union

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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(

Просмотреть файл

@ -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

Просмотреть файл

@ -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.

Просмотреть файл

@ -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.

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -1,5 +1,3 @@
# coding: utf-8
import sys
if sys.version_info < (3, 7):

Просмотреть файл

@ -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() }

Просмотреть файл

@ -1,5 +1,3 @@
# coding: utf-8
import sys
from setuptools import setup, find_packages

Просмотреть файл

@ -5,7 +5,7 @@ skipsdist=True
[testenv]
deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
{toxinidir}
{toxinidir}
commands=
pytest --cov=chromestatus_openapi

Просмотреть файл

@ -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"
}
}

25
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": {