From c06079af0949ac44472c9fdc2fc81766316cb88d Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 May 2019 19:15:41 -0700 Subject: schema: allow releases expansion on file/fileset/webcapture And codegen rust and python --- fatcat-openapi2.yml | 21 +++++++-- python_client/fatcat_client/api/default_api.py | 12 ++--- python_client/fatcat_client/models/file_entity.py | 31 ++++++++++++- .../fatcat_client/models/fileset_entity.py | 31 ++++++++++++- .../fatcat_client/models/webcapture_entity.py | 31 ++++++++++++- rust/fatcat-api-spec/README.md | 2 +- rust/fatcat-api-spec/api.yaml | 21 +++++++-- rust/fatcat-api-spec/api/swagger.yaml | 52 +++++++++++++++++++--- rust/fatcat-api-spec/src/models.rs | 18 ++++++++ 9 files changed, 198 insertions(+), 21 deletions(-) diff --git a/fatcat-openapi2.yml b/fatcat-openapi2.yml index 92253e9d..bac0efaa 100644 --- a/fatcat-openapi2.yml +++ b/fatcat-openapi2.yml @@ -188,6 +188,11 @@ definitions: type: array items: <<: *FATCATIDENT + releases: + description: "Optional; GET-only" + type: array + items: + $ref: "#/definitions/release_entity" file_url: type: object required: @@ -218,6 +223,11 @@ definitions: type: array items: <<: *FATCATIDENT + releases: + description: "Optional; GET-only" + type: array + items: + $ref: "#/definitions/release_entity" fileset_url: type: object required: @@ -278,6 +288,11 @@ definitions: type: array items: <<: *FATCATIDENT + releases: + description: "Optional; GET-only" + type: array + items: + $ref: "#/definitions/release_entity" webcapture_cdx_line: type: object required: @@ -1382,7 +1397,7 @@ paths: in: query type: string required: false - description: "List of sub-entities to expand in response. For files, none accepted (yet)." + description: "List of sub-entities to expand in response. For files, `releases` is accepted." - name: hide in: query type: string @@ -1637,7 +1652,7 @@ paths: in: query type: string required: false - description: "List of sub-entities to expand in response. For filesets, none accepted (yet)." + description: "List of sub-entities to expand in response. For filesets, `releases` is accepted." - name: hide in: query type: string @@ -1858,7 +1873,7 @@ paths: in: query type: string required: false - description: "List of sub-entities to expand in response. For webcaptures, none accepted (yet)." + description: "List of sub-entities to expand in response. For webcaptures, `releases` is accepted." - name: hide in: query type: string diff --git a/python_client/fatcat_client/api/default_api.py b/python_client/fatcat_client/api/default_api.py index 0a2329e8..8edf15ed 100644 --- a/python_client/fatcat_client/api/default_api.py +++ b/python_client/fatcat_client/api/default_api.py @@ -5463,7 +5463,7 @@ class DefaultApi(object): :param async bool :param str ident: (required) - :param str expand: List of sub-entities to expand in response. For files, none accepted (yet). + :param str expand: List of sub-entities to expand in response. For files, `releases` is accepted. :param str hide: List of entity fields to elide in response. For files, none accepted (yet). :return: FileEntity If the method is called asynchronously, @@ -5486,7 +5486,7 @@ class DefaultApi(object): :param async bool :param str ident: (required) - :param str expand: List of sub-entities to expand in response. For files, none accepted (yet). + :param str expand: List of sub-entities to expand in response. For files, `releases` is accepted. :param str hide: List of entity fields to elide in response. For files, none accepted (yet). :return: FileEntity If the method is called asynchronously, @@ -5984,7 +5984,7 @@ class DefaultApi(object): :param async bool :param str ident: (required) - :param str expand: List of sub-entities to expand in response. For filesets, none accepted (yet). + :param str expand: List of sub-entities to expand in response. For filesets, `releases` is accepted. :param str hide: List of entity fields to elide in response. For filesets, 'manifest' is accepted. :return: FilesetEntity If the method is called asynchronously, @@ -6007,7 +6007,7 @@ class DefaultApi(object): :param async bool :param str ident: (required) - :param str expand: List of sub-entities to expand in response. For filesets, none accepted (yet). + :param str expand: List of sub-entities to expand in response. For filesets, `releases` is accepted. :param str hide: List of entity fields to elide in response. For filesets, 'manifest' is accepted. :return: FilesetEntity If the method is called asynchronously, @@ -7329,7 +7329,7 @@ class DefaultApi(object): :param async bool :param str ident: (required) - :param str expand: List of sub-entities to expand in response. For webcaptures, none accepted (yet). + :param str expand: List of sub-entities to expand in response. For webcaptures, `releases` is accepted. :param str hide: List of entity fields to elide in response. For webcaptures, 'cdx' is accepted. :return: WebcaptureEntity If the method is called asynchronously, @@ -7352,7 +7352,7 @@ class DefaultApi(object): :param async bool :param str ident: (required) - :param str expand: List of sub-entities to expand in response. For webcaptures, none accepted (yet). + :param str expand: List of sub-entities to expand in response. For webcaptures, `releases` is accepted. :param str hide: List of entity fields to elide in response. For webcaptures, 'cdx' is accepted. :return: WebcaptureEntity If the method is called asynchronously, diff --git a/python_client/fatcat_client/models/file_entity.py b/python_client/fatcat_client/models/file_entity.py index c876c345..424cd55b 100644 --- a/python_client/fatcat_client/models/file_entity.py +++ b/python_client/fatcat_client/models/file_entity.py @@ -17,6 +17,7 @@ import re # noqa: F401 import six from fatcat_client.models.file_url import FileUrl # noqa: F401,E501 +from fatcat_client.models.release_entity import ReleaseEntity # noqa: F401,E501 class FileEntity(object): @@ -33,6 +34,7 @@ class FileEntity(object): and the value is json key in definition. """ swagger_types = { + 'releases': 'list[ReleaseEntity]', 'release_ids': 'list[str]', 'mimetype': 'str', 'urls': 'list[FileUrl]', @@ -49,6 +51,7 @@ class FileEntity(object): } attribute_map = { + 'releases': 'releases', 'release_ids': 'release_ids', 'mimetype': 'mimetype', 'urls': 'urls', @@ -64,9 +67,10 @@ class FileEntity(object): 'state': 'state' } - def __init__(self, release_ids=None, mimetype=None, urls=None, sha256=None, sha1=None, md5=None, size=None, edit_extra=None, extra=None, redirect=None, revision=None, ident=None, state=None): # noqa: E501 + def __init__(self, releases=None, release_ids=None, mimetype=None, urls=None, sha256=None, sha1=None, md5=None, size=None, edit_extra=None, extra=None, redirect=None, revision=None, ident=None, state=None): # noqa: E501 """FileEntity - a model defined in Swagger""" # noqa: E501 + self._releases = None self._release_ids = None self._mimetype = None self._urls = None @@ -82,6 +86,8 @@ class FileEntity(object): self._state = None self.discriminator = None + if releases is not None: + self.releases = releases if release_ids is not None: self.release_ids = release_ids if mimetype is not None: @@ -109,6 +115,29 @@ class FileEntity(object): if state is not None: self.state = state + @property + def releases(self): + """Gets the releases of this FileEntity. # noqa: E501 + + Optional; GET-only # noqa: E501 + + :return: The releases of this FileEntity. # noqa: E501 + :rtype: list[ReleaseEntity] + """ + return self._releases + + @releases.setter + def releases(self, releases): + """Sets the releases of this FileEntity. + + Optional; GET-only # noqa: E501 + + :param releases: The releases of this FileEntity. # noqa: E501 + :type: list[ReleaseEntity] + """ + + self._releases = releases + @property def release_ids(self): """Gets the release_ids of this FileEntity. # noqa: E501 diff --git a/python_client/fatcat_client/models/fileset_entity.py b/python_client/fatcat_client/models/fileset_entity.py index d4a46a81..5619edb4 100644 --- a/python_client/fatcat_client/models/fileset_entity.py +++ b/python_client/fatcat_client/models/fileset_entity.py @@ -18,6 +18,7 @@ import six from fatcat_client.models.fileset_file import FilesetFile # noqa: F401,E501 from fatcat_client.models.fileset_url import FilesetUrl # noqa: F401,E501 +from fatcat_client.models.release_entity import ReleaseEntity # noqa: F401,E501 class FilesetEntity(object): @@ -34,6 +35,7 @@ class FilesetEntity(object): and the value is json key in definition. """ swagger_types = { + 'releases': 'list[ReleaseEntity]', 'release_ids': 'list[str]', 'urls': 'list[FilesetUrl]', 'manifest': 'list[FilesetFile]', @@ -46,6 +48,7 @@ class FilesetEntity(object): } attribute_map = { + 'releases': 'releases', 'release_ids': 'release_ids', 'urls': 'urls', 'manifest': 'manifest', @@ -57,9 +60,10 @@ class FilesetEntity(object): 'edit_extra': 'edit_extra' } - def __init__(self, release_ids=None, urls=None, manifest=None, state=None, ident=None, revision=None, redirect=None, extra=None, edit_extra=None): # noqa: E501 + def __init__(self, releases=None, release_ids=None, urls=None, manifest=None, state=None, ident=None, revision=None, redirect=None, extra=None, edit_extra=None): # noqa: E501 """FilesetEntity - a model defined in Swagger""" # noqa: E501 + self._releases = None self._release_ids = None self._urls = None self._manifest = None @@ -71,6 +75,8 @@ class FilesetEntity(object): self._edit_extra = None self.discriminator = None + if releases is not None: + self.releases = releases if release_ids is not None: self.release_ids = release_ids if urls is not None: @@ -90,6 +96,29 @@ class FilesetEntity(object): if edit_extra is not None: self.edit_extra = edit_extra + @property + def releases(self): + """Gets the releases of this FilesetEntity. # noqa: E501 + + Optional; GET-only # noqa: E501 + + :return: The releases of this FilesetEntity. # noqa: E501 + :rtype: list[ReleaseEntity] + """ + return self._releases + + @releases.setter + def releases(self, releases): + """Sets the releases of this FilesetEntity. + + Optional; GET-only # noqa: E501 + + :param releases: The releases of this FilesetEntity. # noqa: E501 + :type: list[ReleaseEntity] + """ + + self._releases = releases + @property def release_ids(self): """Gets the release_ids of this FilesetEntity. # noqa: E501 diff --git a/python_client/fatcat_client/models/webcapture_entity.py b/python_client/fatcat_client/models/webcapture_entity.py index 03c0e595..9ff8fd28 100644 --- a/python_client/fatcat_client/models/webcapture_entity.py +++ b/python_client/fatcat_client/models/webcapture_entity.py @@ -16,6 +16,7 @@ import re # noqa: F401 import six +from fatcat_client.models.release_entity import ReleaseEntity # noqa: F401,E501 from fatcat_client.models.webcapture_cdx_line import WebcaptureCdxLine # noqa: F401,E501 from fatcat_client.models.webcapture_url import WebcaptureUrl # noqa: F401,E501 @@ -34,6 +35,7 @@ class WebcaptureEntity(object): and the value is json key in definition. """ swagger_types = { + 'releases': 'list[ReleaseEntity]', 'release_ids': 'list[str]', 'timestamp': 'datetime', 'original_url': 'str', @@ -48,6 +50,7 @@ class WebcaptureEntity(object): } attribute_map = { + 'releases': 'releases', 'release_ids': 'release_ids', 'timestamp': 'timestamp', 'original_url': 'original_url', @@ -61,9 +64,10 @@ class WebcaptureEntity(object): 'state': 'state' } - def __init__(self, release_ids=None, timestamp=None, original_url=None, archive_urls=None, cdx=None, edit_extra=None, extra=None, redirect=None, revision=None, ident=None, state=None): # noqa: E501 + def __init__(self, releases=None, release_ids=None, timestamp=None, original_url=None, archive_urls=None, cdx=None, edit_extra=None, extra=None, redirect=None, revision=None, ident=None, state=None): # noqa: E501 """WebcaptureEntity - a model defined in Swagger""" # noqa: E501 + self._releases = None self._release_ids = None self._timestamp = None self._original_url = None @@ -77,6 +81,8 @@ class WebcaptureEntity(object): self._state = None self.discriminator = None + if releases is not None: + self.releases = releases if release_ids is not None: self.release_ids = release_ids if timestamp is not None: @@ -100,6 +106,29 @@ class WebcaptureEntity(object): if state is not None: self.state = state + @property + def releases(self): + """Gets the releases of this WebcaptureEntity. # noqa: E501 + + Optional; GET-only # noqa: E501 + + :return: The releases of this WebcaptureEntity. # noqa: E501 + :rtype: list[ReleaseEntity] + """ + return self._releases + + @releases.setter + def releases(self, releases): + """Sets the releases of this WebcaptureEntity. + + Optional; GET-only # noqa: E501 + + :param releases: The releases of this WebcaptureEntity. # noqa: E501 + :type: list[ReleaseEntity] + """ + + self._releases = releases + @property def release_ids(self): """Gets the release_ids of this WebcaptureEntity. # noqa: E501 diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index b34efc73..586246d6 100644 --- a/rust/fatcat-api-spec/README.md +++ b/rust/fatcat-api-spec/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.2.0 -- Build date: 2019-05-15T01:33:17.197Z +- Build date: 2019-05-21T01:52:14.169Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml index 92253e9d..bac0efaa 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -188,6 +188,11 @@ definitions: type: array items: <<: *FATCATIDENT + releases: + description: "Optional; GET-only" + type: array + items: + $ref: "#/definitions/release_entity" file_url: type: object required: @@ -218,6 +223,11 @@ definitions: type: array items: <<: *FATCATIDENT + releases: + description: "Optional; GET-only" + type: array + items: + $ref: "#/definitions/release_entity" fileset_url: type: object required: @@ -278,6 +288,11 @@ definitions: type: array items: <<: *FATCATIDENT + releases: + description: "Optional; GET-only" + type: array + items: + $ref: "#/definitions/release_entity" webcapture_cdx_line: type: object required: @@ -1382,7 +1397,7 @@ paths: in: query type: string required: false - description: "List of sub-entities to expand in response. For files, none accepted (yet)." + description: "List of sub-entities to expand in response. For files, `releases` is accepted." - name: hide in: query type: string @@ -1637,7 +1652,7 @@ paths: in: query type: string required: false - description: "List of sub-entities to expand in response. For filesets, none accepted (yet)." + description: "List of sub-entities to expand in response. For filesets, `releases` is accepted." - name: hide in: query type: string @@ -1858,7 +1873,7 @@ paths: in: query type: string required: false - description: "List of sub-entities to expand in response. For webcaptures, none accepted (yet)." + description: "List of sub-entities to expand in response. For webcaptures, `releases` is accepted." - name: hide in: query type: string diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index 02cdcf36..e437df8f 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -1959,8 +1959,8 @@ paths: example: "\"ident_example\".to_string()" - name: "expand" in: "query" - description: "List of sub-entities to expand in response. For files, none\ - \ accepted (yet)." + description: "List of sub-entities to expand in response. For files, `releases`\ + \ is accepted." required: false type: "string" formatString: "{:?}" @@ -2814,8 +2814,8 @@ paths: example: "\"ident_example\".to_string()" - name: "expand" in: "query" - description: "List of sub-entities to expand in response. For filesets, none\ - \ accepted (yet)." + description: "List of sub-entities to expand in response. For filesets, `releases`\ + \ is accepted." required: false type: "string" formatString: "{:?}" @@ -3580,7 +3580,7 @@ paths: - name: "expand" in: "query" description: "List of sub-entities to expand in response. For webcaptures,\ - \ none accepted (yet)." + \ `releases` is accepted." required: false type: "string" formatString: "{:?}" @@ -7399,6 +7399,11 @@ definitions: file_entity: type: "object" properties: + releases: + type: "array" + description: "Optional; GET-only" + items: + $ref: "#/definitions/release_entity" release_ids: type: "array" items: @@ -7473,6 +7478,9 @@ definitions: redirect: "q3nouwy3nnbsvo3h5klxsx4a7y" sha256: "cb1c378f464d5935ddaa8de28446d82638396c61f042295d7fb85e3cccc9e452" ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + releases: + - null + - null revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" sha1: "e9dd75237c94b209dc3ccd52722de6931a310ba3" urls: @@ -7510,6 +7518,11 @@ definitions: fileset_entity: type: "object" properties: + releases: + type: "array" + description: "Optional; GET-only" + items: + $ref: "#/definitions/release_entity" release_ids: type: "array" items: @@ -7586,6 +7599,9 @@ definitions: - "q3nouwy3nnbsvo3h5klxsx4a7y" - "q3nouwy3nnbsvo3h5klxsx4a7y" edit_extra: "{}" + releases: + - null + - null revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" upperCaseName: "FILESET_ENTITY" fileset_url: @@ -7649,6 +7665,11 @@ definitions: webcapture_entity: type: "object" properties: + releases: + type: "array" + description: "Optional; GET-only" + items: + $ref: "#/definitions/release_entity" release_ids: type: "array" items: @@ -7740,6 +7761,9 @@ definitions: - "q3nouwy3nnbsvo3h5klxsx4a7y" - "q3nouwy3nnbsvo3h5klxsx4a7y" edit_extra: "{}" + releases: + - null + - null timestamp: "2000-01-23T04:56:07.000+00:00" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" upperCaseName: "WEBCAPTURE_ENTITY" @@ -7985,6 +8009,9 @@ definitions: - "q3nouwy3nnbsvo3h5klxsx4a7y" - "q3nouwy3nnbsvo3h5klxsx4a7y" edit_extra: "{}" + releases: + - null + - null timestamp: "2000-01-23T04:56:07.000+00:00" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" - redirect: "q3nouwy3nnbsvo3h5klxsx4a7y" @@ -8018,6 +8045,9 @@ definitions: - "q3nouwy3nnbsvo3h5klxsx4a7y" - "q3nouwy3nnbsvo3h5klxsx4a7y" edit_extra: "{}" + releases: + - null + - null timestamp: "2000-01-23T04:56:07.000+00:00" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" ident: "q3nouwy3nnbsvo3h5klxsx4a7y" @@ -8127,6 +8157,9 @@ definitions: - redirect: "q3nouwy3nnbsvo3h5klxsx4a7y" sha256: "cb1c378f464d5935ddaa8de28446d82638396c61f042295d7fb85e3cccc9e452" ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + releases: + - null + - null revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" sha1: "e9dd75237c94b209dc3ccd52722de6931a310ba3" urls: @@ -8146,6 +8179,9 @@ definitions: - redirect: "q3nouwy3nnbsvo3h5klxsx4a7y" sha256: "cb1c378f464d5935ddaa8de28446d82638396c61f042295d7fb85e3cccc9e452" ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + releases: + - null + - null revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" sha1: "e9dd75237c94b209dc3ccd52722de6931a310ba3" urls: @@ -8189,6 +8225,9 @@ definitions: - "q3nouwy3nnbsvo3h5klxsx4a7y" - "q3nouwy3nnbsvo3h5klxsx4a7y" edit_extra: "{}" + releases: + - null + - null revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" - redirect: "q3nouwy3nnbsvo3h5klxsx4a7y" urls: @@ -8216,6 +8255,9 @@ definitions: - "q3nouwy3nnbsvo3h5klxsx4a7y" - "q3nouwy3nnbsvo3h5klxsx4a7y" edit_extra: "{}" + releases: + - null + - null revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" container_id: "q3nouwy3nnbsvo3h5klxsx4a7y" upperCaseName: "RELEASE_ENTITY" diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs index 0ceed261..c8b68328 100644 --- a/rust/fatcat-api-spec/src/models.rs +++ b/rust/fatcat-api-spec/src/models.rs @@ -556,6 +556,11 @@ impl FileAutoBatch { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct FileEntity { + /// Optional; GET-only + #[serde(rename = "releases")] + #[serde(skip_serializing_if = "Option::is_none")] + pub releases: Option>, + #[serde(rename = "release_ids")] #[serde(skip_serializing_if = "Option::is_none")] pub release_ids: Option>, @@ -616,6 +621,7 @@ pub struct FileEntity { impl FileEntity { pub fn new() -> FileEntity { FileEntity { + releases: None, release_ids: None, mimetype: None, urls: None, @@ -668,6 +674,11 @@ impl FilesetAutoBatch { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct FilesetEntity { + /// Optional; GET-only + #[serde(rename = "releases")] + #[serde(skip_serializing_if = "Option::is_none")] + pub releases: Option>, + #[serde(rename = "release_ids")] #[serde(skip_serializing_if = "Option::is_none")] pub release_ids: Option>, @@ -712,6 +723,7 @@ pub struct FilesetEntity { impl FilesetEntity { pub fn new() -> FilesetEntity { FilesetEntity { + releases: None, release_ids: None, urls: None, manifest: None, @@ -1269,6 +1281,11 @@ impl WebcaptureCdxLine { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct WebcaptureEntity { + /// Optional; GET-only + #[serde(rename = "releases")] + #[serde(skip_serializing_if = "Option::is_none")] + pub releases: Option>, + #[serde(rename = "release_ids")] #[serde(skip_serializing_if = "Option::is_none")] pub release_ids: Option>, @@ -1322,6 +1339,7 @@ pub struct WebcaptureEntity { impl WebcaptureEntity { pub fn new() -> WebcaptureEntity { WebcaptureEntity { + releases: None, release_ids: None, timestamp: None, original_url: None, -- cgit v1.2.3