From e70fff418f379a46f066c29240a2d0f82a5ed93e Mon Sep 17 00:00:00 2001 From: Sai Giridhar P Date: Fri, 29 Oct 2021 14:28:52 +0530 Subject: [PATCH 01/12] fix(schema): Updating the component manager spec --- openapi-schema.json | 3250 +++++++++++++++++++++++++++++-------------- 1 file changed, 2232 insertions(+), 1018 deletions(-) diff --git a/openapi-schema.json b/openapi-schema.json index d9ab41f..2167bc3 100644 --- a/openapi-schema.json +++ b/openapi-schema.json @@ -7799,26 +7799,18 @@ "Components" ], "summary": "Get PA components", - "description": "This endpoint returns \r\n\r\n1.List of PA components in a given PA document if document name is provided.\r\n\r\n2.List of components in given directory if directory is provided.", + "description": "This endpoint returns the list of PA components in a given PA document.", "operationId": "getPAComponents", "parameters": [ { "name": "document", "in": "query", "description": "Document Name", + "required": true, "schema": { "type": "string", "description": "Document Name" } - }, - { - "name": "directory", - "in": "query", - "description": "Directory to get the components", - "schema": { - "type": "string", - "description": "Directory to get the components" - } } ], "responses": { @@ -18386,7 +18378,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LinkedPATemplateSummaryRoot" + "$ref": "#/components/schemas/LinkedPATemplatePostSummaryRoot" } } } @@ -18633,7 +18625,7 @@ "x-success-response-types": [ { "status-code": "201", - "response-type": "LinkedPATemplateSummaryRoot" + "response-type": "LinkedPATemplatePostSummaryRoot" } ] }, @@ -19043,7 +19035,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LinkedPATemplateSummaryRoot" + "$ref": "#/components/schemas/LinkedPATemplatePostSummaryRoot" } } } @@ -19297,7 +19289,7 @@ "x-success-response-types": [ { "status-code": "200", - "response-type": "LinkedPATemplateSummaryRoot" + "response-type": "LinkedPATemplatePostSummaryRoot" } ] }, @@ -32931,17 +32923,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/TemplatedPAComponentSummaryRoot" + "$ref": "#/components/schemas/TemplatedPAComponentPostSummaryRoot" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/TemplatedPAComponentSummaryRoot" + "$ref": "#/components/schemas/TemplatedPAComponentPostSummaryRoot" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/TemplatedPAComponentSummaryRoot" + "$ref": "#/components/schemas/TemplatedPAComponentPostSummaryRoot" } } } @@ -33198,45 +33190,32 @@ "x-success-response-types": [ { "status-code": "201", - "response-type": "TemplatedPAComponentSummaryRoot" + "response-type": "TemplatedPAComponentPostSummaryRoot" } ] - } - }, - "/analytics/engines/pa/v3/templated-components/{id}": { - "put": { + }, + "get": { "tags": [ "TemplatedPAComponents" ], - "summary": "Update templated PA component", - "description": "This endpoint allows the user to change the request body from an existing templated PA component.", - "operationId": "updateTemplatedPAComponents", + "summary": "Get templated PA components in path", + "description": "This endpoint returns the list of templated PA components in path.", + "operationId": "getTemplatedPAComponentsInPath", "parameters": [ { - "name": "id", - "in": "path", - "description": "Unique identifier for a templated PA component", + "name": "directory", + "in": "query", + "description": "Get templated PA components in path", "required": true, "schema": { "type": "string", - "description": "Unique identifier for a templated PA component" + "description": "Get templated PA components in path" } } ], - "requestBody": { - "description": "Request Parameters", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TemplatedPAComponentUpdateParametersRoot" - } - } - }, - "required": true - }, "responses": { "200": { - "description": "Expected response, updated successfully.", + "description": "Expected response, returns a list templated PA components.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -33323,50 +33302,6 @@ } } }, - "404": { - "description": "Component or template not found.", - "headers": { - "X-DataDirect-Request-Key": { - "description": "FactSet's request key header.", - "schema": { - "type": "string", - "description": "FactSet's request key header." - } - }, - "X-FactSet-Api-Request-Key": { - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", - "schema": { - "type": "string", - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." - } - }, - "X-FactSet-Api-RateLimit-Limit": { - "description": "Number of allowed requests for the time window.", - "schema": { - "type": "string" - } - }, - "X-FactSet-Api-RateLimit-Remaining": { - "description": "Number of requests left for the time window.", - "schema": { - "type": "string" - } - }, - "X-FactSet-Api-RateLimit-Reset": { - "description": "Number of seconds remaining till rate limit resets.", - "schema": { - "type": "string" - } - } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" - } - } - } - }, "401": { "description": "Missing or invalid authentication.", "headers": { @@ -33531,14 +33466,16 @@ "response-type": "TemplatedPAComponentSummaryRoot" } ] - }, - "delete": { + } + }, + "/analytics/engines/pa/v3/templated-components/{id}": { + "put": { "tags": [ "TemplatedPAComponents" ], - "summary": "Delete templated PA component", - "description": "This endpoint deletes an existing templated PA component", - "operationId": "deleteTemplatedPAComponents", + "summary": "Update templated PA component", + "description": "This endpoint allows the user to change the request body from an existing templated PA component.", + "operationId": "updateTemplatedPAComponents", "parameters": [ { "name": "id", @@ -33551,9 +33488,20 @@ } } ], + "requestBody": { + "description": "Request Parameters", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TemplatedPAComponentUpdateParametersRoot" + } + } + }, + "required": true + }, "responses": { - "204": { - "description": "Expected response, deleted the templated PA component successfully.", + "200": { + "description": "Expected response, updated successfully.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -33587,6 +33535,13 @@ "type": "string" } } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TemplatedPAComponentPostSummaryRoot" + } + } } }, "400": { @@ -33626,25 +33581,15 @@ } }, "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" - } - }, "application/json": { "schema": { "$ref": "#/components/schemas/ClientErrorResponse" } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" - } } } }, "404": { - "description": "Component not found.", + "description": "Component or template not found.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -33680,20 +33625,10 @@ } }, "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" - } - }, "application/json": { "schema": { "$ref": "#/components/schemas/ClientErrorResponse" } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" - } } } }, @@ -33857,34 +33792,33 @@ "x-are-multiple-success-responses-different": false, "x-success-response-types": [ { - "status-code": "204", - "response-type": null + "status-code": "200", + "response-type": "TemplatedPAComponentPostSummaryRoot" } ] - } - }, - "/analytics/engines/pa/v3/unlinked-templates": { - "post": { + }, + "get": { "tags": [ - "UnlinkedPATemplates" + "TemplatedPAComponents" ], - "summary": "Create unlinked PA template", - "description": "This endpoint creates a template which is not linked to any specific PA3 tile. \r\n\r\nRemarks:\r\n\r\n* Mandatory, optional and locked fields can be \"accounts\", \"benchmarks\", \"groups\", \"columns\", \"dates\", \"currencyisocode\" and \"componentdetail\".\r\n\r\n* Mandatory and locked strings are mutually exclusive.", - "operationId": "createUnlinkedPATemplates", - "requestBody": { - "description": "Request Parameters", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UnlinkedPATemplateParametersRoot" - } + "summary": "Get templated PA component by id", + "description": "This endpoint fetches the templated PA component settings.", + "operationId": "getTemplatedPAComponentById", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Unique identifier for a templated PA component", + "required": true, + "schema": { + "type": "string", + "description": "Unique identifier for a templated PA component" } - }, - "required": true - }, + } + ], "responses": { - "201": { - "description": "Expected response, created a unlinked PA template.", + "200": { + "description": "Expected response, templated PA component details.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -33922,7 +33856,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnlinkedPATemplateSummaryRoot" + "$ref": "#/components/schemas/TemplatedPAComponentRoot" } } } @@ -33971,6 +33905,50 @@ } } }, + "404": { + "description": "Templated PA component not found.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + } + } + }, "401": { "description": "Missing or invalid authentication.", "headers": { @@ -34131,41 +34109,70 @@ "x-are-multiple-success-responses-different": false, "x-success-response-types": [ { - "status-code": "201", - "response-type": "UnlinkedPATemplateSummaryRoot" + "status-code": "200", + "response-type": "TemplatedPAComponentRoot" } ] }, - "get": { + "delete": { "tags": [ - "UnlinkedPATemplates" + "TemplatedPAComponents" ], - "summary": "Get unlinked PA templates", - "description": "This endpoint returns the list of unlinked PA templates.", - "operationId": "getUnlinkedPATemplates", + "summary": "Delete templated PA component", + "description": "This endpoint deletes an existing templated PA component", + "operationId": "deleteTemplatedPAComponents", "parameters": [ { - "name": "directory", - "in": "query", - "description": "Get unlinked PA templates in path.", - "schema": { - "type": "string", - "description": "Get unlinked PA templates in path." - } - }, - { - "name": "category", - "in": "query", - "description": "Get unlinked PA templates by category.", + "name": "id", + "in": "path", + "description": "Unique identifier for a templated PA component", + "required": true, "schema": { "type": "string", - "description": "Get unlinked PA templates by category." + "description": "Unique identifier for a templated PA component" } } ], "responses": { - "200": { - "description": "Expected response, returns a list of unlinked PA templates.", + "204": { + "description": "Expected response, deleted the templated PA component successfully.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Invalid data provided. Please check the request parameters before attempting again.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -34201,15 +34208,25 @@ } }, "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + }, "application/json": { "schema": { - "$ref": "#/components/schemas/UnlinkedPATemplateSummaryRoot" + "$ref": "#/components/schemas/ClientErrorResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" } } } }, - "400": { - "description": "Invalid data provided. Please check the request parameters before attempting again.", + "404": { + "description": "Component not found.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -34245,10 +34262,20 @@ } }, "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + }, "application/json": { "schema": { "$ref": "#/components/schemas/ClientErrorResponse" } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } } } }, @@ -34412,46 +34439,34 @@ "x-are-multiple-success-responses-different": false, "x-success-response-types": [ { - "status-code": "200", - "response-type": "UnlinkedPATemplateSummaryRoot" + "status-code": "204", + "response-type": null } ] } }, - "/analytics/engines/pa/v3/unlinked-templates/{id}": { - "put": { + "/analytics/engines/pa/v3/unlinked-templates": { + "post": { "tags": [ "UnlinkedPATemplates" ], - "summary": "Update unlinked PA template", - "description": "This endpoint updates an existing unlinked PA template.\r\n\r\nRemarks:\r\n \r\n* Mandatory, optional and locked fields can be \"accounts\", \"benchmarks\", \"groups\", \"columns\", \"dates\", \"currencyisocode\" and \"componentdetail\".\r\n\r\n* Mandatory and locked strings are mutually exclusive.", - "operationId": "updateUnlinkedPATemplates", - "parameters": [ - { - "name": "id", - "in": "path", - "description": "Unique identifier for an unlinked PA template", - "required": true, - "schema": { - "type": "string", - "description": "Unique identifier for an unlinked PA template" - } - } - ], + "summary": "Create unlinked PA template", + "description": "This endpoint creates a template which is not linked to any specific PA3 tile. \r\n\r\nRemarks:\r\n\r\n* Mandatory, optional and locked fields can be \"accounts\", \"benchmarks\", \"groups\", \"columns\", \"dates\", \"currencyisocode\" and \"componentdetail\".\r\n\r\n* Mandatory and locked strings are mutually exclusive.", + "operationId": "createUnlinkedPATemplates", "requestBody": { "description": "Request Parameters", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnlinkedPATemplateUpdateParametersRoot" + "$ref": "#/components/schemas/UnlinkedPATemplateParametersRoot" } } }, "required": true }, "responses": { - "200": { - "description": "Expected response, updated the unlinked PA template.", + "201": { + "description": "Expected response, created a unlinked PA template.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -34489,7 +34504,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnlinkedPATemplateSummaryRoot" + "$ref": "#/components/schemas/UnlinkedPATemplatePostSummaryRoot" } } } @@ -34538,50 +34553,6 @@ } } }, - "404": { - "description": "Template not found.", - "headers": { - "X-DataDirect-Request-Key": { - "description": "FactSet's request key header.", - "schema": { - "type": "string", - "description": "FactSet's request key header." - } - }, - "X-FactSet-Api-Request-Key": { - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", - "schema": { - "type": "string", - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." - } - }, - "X-FactSet-Api-RateLimit-Limit": { - "description": "Number of allowed requests for the time window.", - "schema": { - "type": "string" - } - }, - "X-FactSet-Api-RateLimit-Remaining": { - "description": "Number of requests left for the time window.", - "schema": { - "type": "string" - } - }, - "X-FactSet-Api-RateLimit-Reset": { - "description": "Number of seconds remaining till rate limit resets.", - "schema": { - "type": "string" - } - } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" - } - } - } - }, "401": { "description": "Missing or invalid authentication.", "headers": { @@ -34742,70 +34713,41 @@ "x-are-multiple-success-responses-different": false, "x-success-response-types": [ { - "status-code": "200", - "response-type": "UnlinkedPATemplateSummaryRoot" + "status-code": "201", + "response-type": "UnlinkedPATemplatePostSummaryRoot" } ] }, - "delete": { + "get": { "tags": [ "UnlinkedPATemplates" ], - "summary": "Delete unlinked PA template", - "description": "This endpoint deletes an existing unliked PA template.", - "operationId": "deleteUnlinkedPATemplates", + "summary": "Get unlinked PA templates", + "description": "This endpoint returns the list of unlinked PA templates.", + "operationId": "getUnlinkedPATemplates", "parameters": [ { - "name": "id", - "in": "path", - "description": "Unique identifier for an unlinked PA template", - "required": true, + "name": "directory", + "in": "query", + "description": "Get unlinked PA templates in path.", "schema": { "type": "string", - "description": "Unique identifier for an unlinked PA template" + "description": "Get unlinked PA templates in path." + } + }, + { + "name": "category", + "in": "query", + "description": "Get unlinked PA templates by category.", + "schema": { + "type": "string", + "description": "Get unlinked PA templates by category." } } ], "responses": { - "204": { - "description": "Expected response, deleted the unlinked PA template successfully.", - "headers": { - "X-DataDirect-Request-Key": { - "description": "FactSet's request key header.", - "schema": { - "type": "string", - "description": "FactSet's request key header." - } - }, - "X-FactSet-Api-Request-Key": { - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", - "schema": { - "type": "string", - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." - } - }, - "X-FactSet-Api-RateLimit-Limit": { - "description": "Number of allowed requests for the time window.", - "schema": { - "type": "string" - } - }, - "X-FactSet-Api-RateLimit-Remaining": { - "description": "Number of requests left for the time window.", - "schema": { - "type": "string" - } - }, - "X-FactSet-Api-RateLimit-Reset": { - "description": "Number of seconds remaining till rate limit resets.", - "schema": { - "type": "string" - } - } - } - }, - "400": { - "description": "Invalid data provided. Please check the request parameters before attempting again.", + "200": { + "description": "Expected response, returns a list of unlinked PA templates.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -34843,13 +34785,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" + "$ref": "#/components/schemas/UnlinkedPATemplateSummaryRoot" } } } }, - "404": { - "description": "Template not found.", + "400": { + "description": "Invalid data provided. Please check the request parameters before attempting again.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -35052,18 +34994,20 @@ "x-are-multiple-success-responses-different": false, "x-success-response-types": [ { - "status-code": "204", - "response-type": null + "status-code": "200", + "response-type": "UnlinkedPATemplateSummaryRoot" } ] - }, - "get": { + } + }, + "/analytics/engines/pa/v3/unlinked-templates/{id}": { + "put": { "tags": [ "UnlinkedPATemplates" ], - "summary": "Get unlinked PA template details by id", - "description": "This endpoint fetches the template settings.", - "operationId": "getUnlinkedPATemplatesById", + "summary": "Update unlinked PA template", + "description": "This endpoint updates an existing unlinked PA template.\r\n\r\nRemarks:\r\n \r\n* Mandatory, optional and locked fields can be \"accounts\", \"benchmarks\", \"groups\", \"columns\", \"dates\", \"currencyisocode\" and \"componentdetail\".\r\n\r\n* Mandatory and locked strings are mutually exclusive.", + "operationId": "updateUnlinkedPATemplates", "parameters": [ { "name": "id", @@ -35076,9 +35020,20 @@ } } ], + "requestBody": { + "description": "Request Parameters", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnlinkedPATemplateUpdateParametersRoot" + } + } + }, + "required": true + }, "responses": { "200": { - "description": "Expected response, get details of the unlinked PA template.", + "description": "Expected response, updated the unlinked PA template.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -35116,7 +35071,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnlinkedPATemplateRoot" + "$ref": "#/components/schemas/UnlinkedPATemplatePostSummaryRoot" } } } @@ -35370,22 +35325,69 @@ "x-success-response-types": [ { "status-code": "200", - "response-type": "UnlinkedPATemplateRoot" + "response-type": "UnlinkedPATemplatePostSummaryRoot" } ] - } - }, - "/analytics/engines/pa/v3/unlinked-templates/template-types": { - "get": { + }, + "delete": { "tags": [ "UnlinkedPATemplates" ], - "summary": "Get default unlinked PA template types.", - "description": "This endpoint fetches default unlinked PA template types.", - "operationId": "getDefaultUnlinkedPATemplateTypes", + "summary": "Delete unlinked PA template", + "description": "This endpoint deletes an existing unliked PA template.", + "operationId": "deleteUnlinkedPATemplates", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Unique identifier for an unlinked PA template", + "required": true, + "schema": { + "type": "string", + "description": "Unique identifier for an unlinked PA template" + } + } + ], "responses": { - "200": { - "description": "Expected response, default unlinked PA template types", + "204": { + "description": "Expected response, deleted the unlinked PA template successfully.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Invalid data provided. Please check the request parameters before attempting again.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -35423,7 +35425,51 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnlinkedPATemplateCategoryAndTypeRoot" + "$ref": "#/components/schemas/ClientErrorResponse" + } + } + } + }, + "404": { + "description": "Template not found.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" } } } @@ -35588,35 +35634,33 @@ "x-are-multiple-success-responses-different": false, "x-success-response-types": [ { - "status-code": "200", - "response-type": "UnlinkedPATemplateCategoryAndTypeRoot" + "status-code": "204", + "response-type": null } ] - } - }, - "/analytics/engines/pa/v3/unlinked-templates/template-types/{id}": { + }, "get": { "tags": [ "UnlinkedPATemplates" ], - "summary": "Get unlinked PA template type details by id.", - "description": "This endpoint fetches the unlinked PA template type details.", - "operationId": "getDetailsType", + "summary": "Get unlinked PA template details by id", + "description": "This endpoint fetches the template settings.", + "operationId": "getUnlinkedPATemplatesById", "parameters": [ { "name": "id", "in": "path", - "description": "Unique identifier for an unlinked PA template type", + "description": "Unique identifier for an unlinked PA template", "required": true, "schema": { "type": "string", - "description": "Unique identifier for an unlinked PA template type" + "description": "Unique identifier for an unlinked PA template" } } ], "responses": { "200": { - "description": "Expected response, details of the unlinked PA template type", + "description": "Expected response, get details of the unlinked PA template.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -35654,7 +35698,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnlinkedPATemplateCategoryAndTypeDetailsRoot" + "$ref": "#/components/schemas/UnlinkedPATemplateRoot" } } } @@ -35704,7 +35748,7 @@ } }, "404": { - "description": "Unlinked PA template type not found.", + "description": "Template not found.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -35908,106 +35952,22 @@ "x-success-response-types": [ { "status-code": "200", - "response-type": "UnlinkedPATemplateCategoryAndTypeDetailsRoot" + "response-type": "UnlinkedPATemplateRoot" } ] } }, - "/analytics/engines/vault/v3/calculations": { - "post": { + "/analytics/engines/pa/v3/unlinked-templates/template-types": { + "get": { "tags": [ - "VaultCalculations" - ], - "summary": "Create and Run Vault calculation", - "description": "This endpoint runs the Vault calculation specified in the POST body parameters.\r\nIt can take one or more units as input.\r\n\r\nRemarks:\r\n\r\n* Start and and end date must be within the configuration's min and max date range", - "operationId": "postAndCalculate", - "parameters": [ - { - "name": "X-FactSet-Api-Long-Running-Deadline", - "in": "header", - "description": "Long running deadline in seconds when only one unit is passed in the POST body.", - "schema": { - "type": "integer" - } - }, - { - "name": "Cache-Control", - "in": "header", - "description": "Standard HTTP header. Accepts max-stale.", - "schema": { - "type": "string" - } - } + "UnlinkedPATemplates" ], - "requestBody": { - "description": "Calculation Parameters", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VaultCalculationParametersRoot" - } - } - } - }, + "summary": "Get default unlinked PA template types.", + "description": "This endpoint fetches default unlinked PA template types.", + "operationId": "getDefaultUnlinkedPATemplateTypes", "responses": { - "202": { - "description": "Expected response, contains the poll URL in the Location header.", - "headers": { - "Location": { - "description": "URL to poll for the resulting calculation", - "schema": { - "type": "string", - "description": "URL to poll for the resulting calculation" - } - }, - "X-DataDirect-Request-Key": { - "description": "FactSet's request key header.", - "schema": { - "type": "string", - "description": "FactSet's request key header." - } - }, - "X-FactSet-Api-Request-Key": { - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", - "schema": { - "type": "string", - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." - } - }, - "X-FactSet-Api-RateLimit-Limit": { - "description": "Number of allowed requests for the time window.", - "schema": { - "type": "string" - } - }, - "X-FactSet-Api-RateLimit-Remaining": { - "description": "Number of requests left for the time window.", - "schema": { - "type": "string" - } - }, - "X-FactSet-Api-RateLimit-Reset": { - "description": "Number of seconds remaining till rate limit resets.", - "schema": { - "type": "string" - } - } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CalculationStatusRoot" - } - }, - "application/x-protobuf": { - "schema": { - "$ref": "#/components/schemas/CalculationStatusRoot" - } - } - } - }, "200": { - "description": "Expected response, if the calculation has one unit and is completed with an error.", + "description": "Expected response, default unlinked PA template types", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -36045,18 +36005,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CalculationStatusRoot" - } - }, - "application/x-protobuf": { - "schema": { - "$ref": "#/components/schemas/CalculationStatusRoot" + "$ref": "#/components/schemas/UnlinkedPATemplateCategoryAndTypeRoot" } } } }, - "201": { - "description": "Expected response if the calculation has one unit and is completed in a short span, returns JSON in the format specified in the Calculation parameters.", + "401": { + "description": "Missing or invalid authentication.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -36071,41 +36026,11 @@ "type": "string", "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." } - }, - "X-FactSet-Api-RateLimit-Limit": { - "description": "Number of allowed requests for the time window.", - "schema": { - "type": "string" - } - }, - "X-FactSet-Api-RateLimit-Remaining": { - "description": "Number of requests left for the time window.", - "schema": { - "type": "string" - } - }, - "X-FactSet-Api-RateLimit-Reset": { - "description": "Number of seconds remaining till rate limit resets.", - "schema": { - "type": "string" - } - } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ObjectRoot" - } - }, - "application/x-protobuf": { - "schema": { - "$ref": "#/components/schemas/ObjectRoot" - } } } }, - "400": { - "description": "Invalid calculation parameters.", + "403": { + "description": "User is forbidden with current credentials", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -36139,22 +36064,10 @@ "type": "string" } } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" - } - }, - "application/x-protobuf": { - "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" - } - } } }, - "404": { - "description": "One or more calculation settings were unavailable.", + "406": { + "description": "Unsupported Accept header. Header needs to be set to application/json.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -36188,22 +36101,35 @@ "type": "string" } } - }, - "content": { - "application/json": { + } + }, + "429": { + "description": "Rate limit reached. Wait till the time specified in Retry-After header value to make further requests.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" + "type": "string", + "description": "FactSet's request key header." } }, - "application/x-protobuf": { + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "Retry-After": { + "description": "Time to wait in seconds before making a new request as the rate limit has reached.", + "schema": { + "type": "string" } } } }, - "401": { - "description": "Missing or invalid authentication.", + "500": { + "description": "Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -36221,8 +36147,58 @@ } } }, - "403": { - "description": "User is forbidden with current credentials", + "503": { + "description": "Request timed out. Retry the request in sometime.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + } + } + } + }, + "x-are-multiple-success-responses-different": false, + "x-success-response-types": [ + { + "status-code": "200", + "response-type": "UnlinkedPATemplateCategoryAndTypeRoot" + } + ] + } + }, + "/analytics/engines/pa/v3/unlinked-templates/template-types/{id}": { + "get": { + "tags": [ + "UnlinkedPATemplates" + ], + "summary": "Get unlinked PA template type details by id.", + "description": "This endpoint fetches the unlinked PA template type details.", + "operationId": "getDetailsType", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Unique identifier for an unlinked PA template type", + "required": true, + "schema": { + "type": "string", + "description": "Unique identifier for an unlinked PA template type" + } + } + ], + "responses": { + "200": { + "description": "Expected response, details of the unlinked PA template type", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -36256,10 +36232,17 @@ "type": "string" } } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnlinkedPATemplateCategoryAndTypeDetailsRoot" + } + } } }, - "415": { - "description": "Missing/Invalid Content-Type header. Header needs to be set to application/json.", + "400": { + "description": "Invalid data provided. Please check the request parameters before attempting again.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -36293,10 +36276,17 @@ "type": "string" } } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + } } }, - "429": { - "description": "Rate limit reached. Cancel older requests using Cancel Calculation endpoint or wait for older requests to finish/expire.", + "404": { + "description": "Unlinked PA template type not found.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -36329,6 +36319,125 @@ "schema": { "type": "string" } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + } + } + }, + "401": { + "description": "Missing or invalid authentication.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + } + } + }, + "403": { + "description": "User is forbidden with current credentials", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } + } + } + }, + "406": { + "description": "Unsupported Accept header. Header needs to be set to application/json.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } + } + } + }, + "429": { + "description": "Rate limit reached. Wait till the time specified in Retry-After header value to make further requests.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } }, "Retry-After": { "description": "Time to wait in seconds before making a new request as the rate limit has reached.", @@ -36377,46 +36486,28 @@ } } }, - "x-are-multiple-success-responses-different": true, + "x-are-multiple-success-responses-different": false, "x-success-response-types": [ - { - "status-code": "202", - "response-type": "CalculationStatusRoot" - }, { "status-code": "200", - "response-type": "CalculationStatusRoot" - }, - { - "status-code": "201", - "response-type": "ObjectRoot" + "response-type": "UnlinkedPATemplateCategoryAndTypeDetailsRoot" } ] } }, - "/analytics/engines/vault/v3/calculations/{id}": { - "put": { + "/analytics/engines/vault/v3/calculations": { + "post": { "tags": [ "VaultCalculations" ], - "summary": "Create or Update Vault calculation and run it.", - "description": "This endpoint updates and run the Vault calculation specified in the PUT body parameters. This also allows creating new Vault calculations with custom ids.\r\nIt can take one or more units as input.\r\n\r\nRemarks:\r\n\r\n* Start and and end date must be within the configuration's min and max date range", - "operationId": "putAndCalculate", + "summary": "Create and Run Vault calculation", + "description": "This endpoint runs the Vault calculation specified in the POST body parameters.\r\nIt can take one or more units as input.\r\n\r\nRemarks:\r\n\r\n* Start and and end date must be within the configuration's min and max date range", + "operationId": "postAndCalculate", "parameters": [ - { - "name": "id", - "in": "path", - "description": "from url, provided from the location header in the Create and Run Vault calculation endpoint", - "required": true, - "schema": { - "type": "string", - "description": "from url, provided from the location header in the Create and Run Vault calculation endpoint" - } - }, { "name": "X-FactSet-Api-Long-Running-Deadline", "in": "header", - "description": "Long running deadline in seconds when only one unit is passed in the PUT body.", + "description": "Long running deadline in seconds when only one unit is passed in the POST body.", "schema": { "type": "integer" } @@ -36596,7 +36687,7 @@ } }, "400": { - "description": "Invalid Calculation Parameters.", + "description": "Invalid calculation parameters.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -36693,55 +36784,6 @@ } } }, - "409": { - "description": "Duplicate calculation exists with same parameters.", - "headers": { - "X-DataDirect-Request-Key": { - "description": "FactSet's request key header.", - "schema": { - "type": "string", - "description": "FactSet's request key header." - } - }, - "X-FactSet-Api-Request-Key": { - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", - "schema": { - "type": "string", - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." - } - }, - "X-FactSet-Api-RateLimit-Limit": { - "description": "Number of allowed requests for the time window.", - "schema": { - "type": "string" - } - }, - "X-FactSet-Api-RateLimit-Remaining": { - "description": "Number of requests left for the time window.", - "schema": { - "type": "string" - } - }, - "X-FactSet-Api-RateLimit-Reset": { - "description": "Number of seconds remaining till rate limit resets.", - "schema": { - "type": "string" - } - } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" - } - }, - "application/x-protobuf": { - "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" - } - } - } - }, "401": { "description": "Missing or invalid authentication.", "headers": { @@ -36932,14 +36974,16 @@ "response-type": "ObjectRoot" } ] - }, - "get": { + } + }, + "/analytics/engines/vault/v3/calculations/{id}": { + "put": { "tags": [ "VaultCalculations" ], - "summary": "Get Vault calculation parameters by id", - "description": "This is the endpoint that returns the calculation parameters passed for a calculation.", - "operationId": "getCalculationParameters", + "summary": "Create or Update Vault calculation and run it.", + "description": "This endpoint updates and run the Vault calculation specified in the PUT body parameters. This also allows creating new Vault calculations with custom ids.\r\nIt can take one or more units as input.\r\n\r\nRemarks:\r\n\r\n* Start and and end date must be within the configuration's min and max date range", + "operationId": "putAndCalculate", "parameters": [ { "name": "id", @@ -36950,31 +36994,43 @@ "type": "string", "description": "from url, provided from the location header in the Create and Run Vault calculation endpoint" } + }, + { + "name": "X-FactSet-Api-Long-Running-Deadline", + "in": "header", + "description": "Long running deadline in seconds when only one unit is passed in the PUT body.", + "schema": { + "type": "integer" + } + }, + { + "name": "Cache-Control", + "in": "header", + "description": "Standard HTTP header. Accepts max-stale.", + "schema": { + "type": "string" + } } ], + "requestBody": { + "description": "Calculation Parameters", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultCalculationParametersRoot" + } + } + } + }, "responses": { - "200": { - "description": "Expected response, returns the Vault calculation parameters.", + "202": { + "description": "Expected response, contains the poll URL in the Location header.", "headers": { - "Content-Encoding": { - "description": "Standard HTTP header. Header value based on Accept-Encoding Request header.", - "schema": { - "type": "string", - "description": "Standard HTTP header. Header value based on Accept-Encoding Request header." - } - }, - "Content-Type": { - "description": "Standard HTTP header.", - "schema": { - "type": "string", - "description": "Standard HTTP header." - } - }, - "Transfer-Encoding": { - "description": "Standard HTTP header. Header value will be set to Chunked if Accept-Encoding header is specified.", + "Location": { + "description": "URL to poll for the resulting calculation", "schema": { "type": "string", - "description": "Standard HTTP header. Header value will be set to Chunked if Accept-Encoding header is specified." + "description": "URL to poll for the resulting calculation" } }, "X-DataDirect-Request-Key": { @@ -37013,13 +37069,18 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VaultCalculationParametersRoot" + "$ref": "#/components/schemas/CalculationStatusRoot" + } + }, + "application/x-protobuf": { + "schema": { + "$ref": "#/components/schemas/CalculationStatusRoot" } } } }, - "400": { - "description": "Invalid identifier provided.", + "200": { + "description": "Expected response, if the calculation has one unit and is completed with an error.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -37057,13 +37118,18 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" + "$ref": "#/components/schemas/CalculationStatusRoot" + } + }, + "application/x-protobuf": { + "schema": { + "$ref": "#/components/schemas/CalculationStatusRoot" } } } }, - "404": { - "description": "Calculation id not found", + "201": { + "description": "Expected response if the calculation has one unit and is completed in a short span, returns JSON in the format specified in the Calculation parameters.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -37101,32 +37167,18 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" - } - } - } - }, - "401": { - "description": "Missing or invalid authentication.", - "headers": { - "X-DataDirect-Request-Key": { - "description": "FactSet's request key header.", - "schema": { - "type": "string", - "description": "FactSet's request key header." + "$ref": "#/components/schemas/ObjectRoot" } }, - "X-FactSet-Api-Request-Key": { - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "application/x-protobuf": { "schema": { - "type": "string", - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + "$ref": "#/components/schemas/ObjectRoot" } } } }, - "403": { - "description": "User is forbidden with current credentials", + "400": { + "description": "Invalid Calculation Parameters.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -37160,77 +37212,22 @@ "type": "string" } } - } - }, - "500": { - "description": "Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting", - "headers": { - "X-DataDirect-Request-Key": { - "description": "FactSet's request key header.", + }, + "content": { + "application/json": { "schema": { - "type": "string", - "description": "FactSet's request key header." + "$ref": "#/components/schemas/ClientErrorResponse" } }, - "X-FactSet-Api-Request-Key": { - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "application/x-protobuf": { "schema": { - "type": "string", - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + "$ref": "#/components/schemas/ClientErrorResponse" } } } }, - "503": { - "description": "Request timed out. Retry the request in sometime.", - "headers": { - "X-DataDirect-Request-Key": { - "description": "FactSet's request key header.", - "schema": { - "type": "string", - "description": "FactSet's request key header." - } - }, - "X-FactSet-Api-Request-Key": { - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", - "schema": { - "type": "string", - "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." - } - } - } - } - }, - "x-are-multiple-success-responses-different": false, - "x-success-response-types": [ - { - "status-code": "200", - "response-type": "VaultCalculationParametersRoot" - } - ] - }, - "delete": { - "tags": [ - "VaultCalculations" - ], - "summary": "Cancel Vault calculation by id", - "description": "This is the endpoint to cancel a previously submitted calculation.", - "operationId": "cancelCalculationById", - "parameters": [ - { - "name": "id", - "in": "path", - "description": "from url, provided from the location header in the Create and Run Vault calculation endpoint", - "required": true, - "schema": { - "type": "string", - "description": "from url, provided from the location header in the Create and Run Vault calculation endpoint" - } - } - ], - "responses": { - "204": { - "description": "Expected response, calculation was canceled successfully.", + "404": { + "description": "One or more calculation settings were unavailable.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -37264,10 +37261,22 @@ "type": "string" } } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + }, + "application/x-protobuf": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + } } }, - "400": { - "description": "Invalid identifier provided.", + "409": { + "description": "Duplicate calculation exists with same parameters.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -37303,25 +37312,39 @@ } }, "content": { - "text/plain": { + "application/json": { "schema": { "$ref": "#/components/schemas/ClientErrorResponse" } }, - "application/json": { + "application/x-protobuf": { "schema": { "$ref": "#/components/schemas/ClientErrorResponse" } + } + } + }, + "401": { + "description": "Missing or invalid authentication.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } }, - "text/json": { + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." } } } }, - "404": { - "description": "There was no request for the calculation identifier provided, or the request was already canceled for the provided identifier.", + "403": { + "description": "User is forbidden with current credentials", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -37355,27 +37378,10 @@ "type": "string" } } - }, - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ClientErrorResponse" - } - } } }, - "401": { - "description": "Missing or invalid authentication.", + "415": { + "description": "Missing/Invalid Content-Type header. Header needs to be set to application/json.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -37390,11 +37396,29 @@ "type": "string", "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } } } }, - "403": { - "description": "User is forbidden with current credentials", + "429": { + "description": "Rate limit reached. Cancel older requests using Cancel Calculation endpoint or wait for older requests to finish/expire.", "headers": { "X-DataDirect-Request-Key": { "description": "FactSet's request key header.", @@ -37427,6 +37451,12 @@ "schema": { "type": "string" } + }, + "Retry-After": { + "description": "Time to wait in seconds before making a new request as the rate limit has reached.", + "schema": { + "type": "string" + } } } }, @@ -37469,23 +37499,29 @@ } } }, - "x-are-multiple-success-responses-different": false, + "x-are-multiple-success-responses-different": true, "x-success-response-types": [ { - "status-code": "204", - "response-type": null + "status-code": "202", + "response-type": "CalculationStatusRoot" + }, + { + "status-code": "200", + "response-type": "CalculationStatusRoot" + }, + { + "status-code": "201", + "response-type": "ObjectRoot" } ] - } - }, - "/analytics/engines/vault/v3/calculations/{id}/status": { + }, "get": { "tags": [ "VaultCalculations" ], - "summary": "Get Vault calculation status by id", - "description": "This is the endpoint to check on the progress of a previously requested calculation.\r\nIf the calculation has finished computing, the location header will point to the result url.", - "operationId": "getCalculationStatusById", + "summary": "Get Vault calculation parameters by id", + "description": "This is the endpoint that returns the calculation parameters passed for a calculation.", + "operationId": "getCalculationParameters", "parameters": [ { "name": "id", @@ -37500,7 +37536,553 @@ ], "responses": { "200": { - "description": "Expected response once calculation is completed.", + "description": "Expected response, returns the Vault calculation parameters.", + "headers": { + "Content-Encoding": { + "description": "Standard HTTP header. Header value based on Accept-Encoding Request header.", + "schema": { + "type": "string", + "description": "Standard HTTP header. Header value based on Accept-Encoding Request header." + } + }, + "Content-Type": { + "description": "Standard HTTP header.", + "schema": { + "type": "string", + "description": "Standard HTTP header." + } + }, + "Transfer-Encoding": { + "description": "Standard HTTP header. Header value will be set to Chunked if Accept-Encoding header is specified.", + "schema": { + "type": "string", + "description": "Standard HTTP header. Header value will be set to Chunked if Accept-Encoding header is specified." + } + }, + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultCalculationParametersRoot" + } + } + } + }, + "400": { + "description": "Invalid identifier provided.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + } + } + }, + "404": { + "description": "Calculation id not found", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + } + } + }, + "401": { + "description": "Missing or invalid authentication.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + } + } + }, + "403": { + "description": "User is forbidden with current credentials", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + } + } + }, + "503": { + "description": "Request timed out. Retry the request in sometime.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + } + } + } + }, + "x-are-multiple-success-responses-different": false, + "x-success-response-types": [ + { + "status-code": "200", + "response-type": "VaultCalculationParametersRoot" + } + ] + }, + "delete": { + "tags": [ + "VaultCalculations" + ], + "summary": "Cancel Vault calculation by id", + "description": "This is the endpoint to cancel a previously submitted calculation.", + "operationId": "cancelCalculationById", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "from url, provided from the location header in the Create and Run Vault calculation endpoint", + "required": true, + "schema": { + "type": "string", + "description": "from url, provided from the location header in the Create and Run Vault calculation endpoint" + } + } + ], + "responses": { + "204": { + "description": "Expected response, calculation was canceled successfully.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Invalid identifier provided.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } + } + }, + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + } + } + }, + "404": { + "description": "There was no request for the calculation identifier provided, or the request was already canceled for the provided identifier.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } + } + }, + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ClientErrorResponse" + } + } + } + }, + "401": { + "description": "Missing or invalid authentication.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + } + } + }, + "403": { + "description": "User is forbidden with current credentials", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + }, + "X-FactSet-Api-RateLimit-Limit": { + "description": "Number of allowed requests for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Remaining": { + "description": "Number of requests left for the time window.", + "schema": { + "type": "string" + } + }, + "X-FactSet-Api-RateLimit-Reset": { + "description": "Number of seconds remaining till rate limit resets.", + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + } + } + }, + "503": { + "description": "Request timed out. Retry the request in sometime.", + "headers": { + "X-DataDirect-Request-Key": { + "description": "FactSet's request key header.", + "schema": { + "type": "string", + "description": "FactSet's request key header." + } + }, + "X-FactSet-Api-Request-Key": { + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication.", + "schema": { + "type": "string", + "description": "Key to uniquely identify an Analytics API request. Only available after successful authentication." + } + } + } + } + }, + "x-are-multiple-success-responses-different": false, + "x-success-response-types": [ + { + "status-code": "204", + "response-type": null + } + ] + } + }, + "/analytics/engines/vault/v3/calculations/{id}/status": { + "get": { + "tags": [ + "VaultCalculations" + ], + "summary": "Get Vault calculation status by id", + "description": "This is the endpoint to check on the progress of a previously requested calculation.\r\nIf the calculation has finished computing, the location header will point to the result url.", + "operationId": "getCalculationStatusById", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "from url, provided from the location header in the Create and Run Vault calculation endpoint", + "required": true, + "schema": { + "type": "string", + "description": "from url, provided from the location header in the Create and Run Vault calculation endpoint" + } + } + ], + "responses": { + "200": { + "description": "Expected response once calculation is completed.", "headers": { "Content-Encoding": { "description": "Standard HTTP header. Header value based on Accept-Encoding Request header.", @@ -38133,7 +38715,8 @@ "id": { "type": "string" } - } + }, + "additionalProperties": false }, "SPARAccounts": { "type": "object", @@ -38145,7 +38728,8 @@ }, "description": "List of SPAR returnsType" } - } + }, + "additionalProperties": false }, "SPARAccountsRoot": { "required": [ @@ -38156,10 +38740,9 @@ "data": { "$ref": "#/components/schemas/SPARAccounts" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "ErrorSource": { "type": "object", @@ -38170,7 +38753,8 @@ "parameter": { "type": "string" } - } + }, + "additionalProperties": false }, "Error": { "type": "object", @@ -38184,7 +38768,8 @@ "source": { "$ref": "#/components/schemas/ErrorSource" } - } + }, + "additionalProperties": false }, "ClientErrorResponse": { "type": "object", @@ -38195,7 +38780,8 @@ "$ref": "#/components/schemas/Error" } } - } + }, + "additionalProperties": false }, "AccountDirectories": { "type": "object", @@ -38214,7 +38800,8 @@ }, "description": "List of directories." } - } + }, + "additionalProperties": false }, "AccountDirectoriesRoot": { "required": [ @@ -38225,10 +38812,9 @@ "data": { "$ref": "#/components/schemas/AccountDirectories" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "AFIOptimizerStrategyOverrides": { "type": "object", @@ -38260,7 +38846,8 @@ "type": "string", "description": "Transaction cost" } - } + }, + "additionalProperties": false }, "AFIOptimizerStrategy": { "required": [ @@ -38275,7 +38862,8 @@ "type": "string", "description": "OptimizerStrategy document path" } - } + }, + "additionalProperties": false }, "OptimizerAccountOverrides": { "type": "object", @@ -38296,7 +38884,8 @@ "type": "string", "description": "Currency" } - } + }, + "additionalProperties": false }, "OptimizerAccount": { "type": "object", @@ -38308,7 +38897,8 @@ "overrides": { "$ref": "#/components/schemas/OptimizerAccountOverrides" } - } + }, + "additionalProperties": false }, "Optimization": { "type": "object", @@ -38325,7 +38915,8 @@ "type": "string", "description": "Cash flow" } - } + }, + "additionalProperties": false }, "OptimizerTradesList": { "type": "object", @@ -38350,7 +38941,8 @@ "type": "boolean", "description": "Include cash" } - } + }, + "additionalProperties": false }, "OptimizerOptimalHoldings": { "type": "object", @@ -38379,7 +38971,8 @@ "type": "boolean", "description": "Exclude zero" } - } + }, + "additionalProperties": false }, "OptimalPortfolio": { "type": "object", @@ -38414,10 +39007,12 @@ "type": "string", "description": "Action if ofdb date exists" } - } + }, + "additionalProperties": false }, "OptimizerStats": { - "type": "object" + "type": "object", + "additionalProperties": false }, "OptimizerOutputTypes": { "type": "object", @@ -38434,7 +39029,8 @@ "stats": { "$ref": "#/components/schemas/OptimizerStats" } - } + }, + "additionalProperties": false }, "AFIOptimizationParameters": { "required": [ @@ -38455,10 +39051,12 @@ "outputTypes": { "$ref": "#/components/schemas/OptimizerOutputTypes" } - } + }, + "additionalProperties": false }, "OptimizerCalculationMeta": { - "type": "object" + "type": "object", + "additionalProperties": false }, "AFIOptimizationParametersRoot": { "type": "object", @@ -38469,7 +39067,8 @@ "meta": { "$ref": "#/components/schemas/OptimizerCalculationMeta" } - } + }, + "additionalProperties": false }, "CalculationInfo": { "type": "object", @@ -38478,7 +39077,8 @@ "type": "string", "description": "Calculation identifier" } - } + }, + "additionalProperties": false }, "CalculationInfoRoot": { "required": [ @@ -38489,10 +39089,9 @@ "data": { "$ref": "#/components/schemas/CalculationInfo" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "ObjectRoot": { "required": [ @@ -38500,13 +39099,10 @@ ], "type": "object", "properties": { - "data": { - "type": "object" - }, - "meta": { - "type": "object" - } - } + "data": { }, + "meta": { } + }, + "additionalProperties": false }, "AxiomaEquityOptimizerStrategyOverrides": { "type": "object", @@ -38538,7 +39134,8 @@ "type": "string", "description": "Transaction cost" } - } + }, + "additionalProperties": false }, "AxiomaEquityOptimizerStrategy": { "required": [ @@ -38553,7 +39150,8 @@ "type": "string", "description": "OptimizerStrategy document path" } - } + }, + "additionalProperties": false }, "AxiomaEquityOptimizationParameters": { "required": [ @@ -38574,7 +39172,8 @@ "outputTypes": { "$ref": "#/components/schemas/OptimizerOutputTypes" } - } + }, + "additionalProperties": false }, "AxiomaEquityOptimizationParametersRoot": { "type": "object", @@ -38585,7 +39184,8 @@ "meta": { "$ref": "#/components/schemas/OptimizerCalculationMeta" } - } + }, + "additionalProperties": false }, "SPARIdentifier": { "required": [ @@ -38606,6 +39206,7 @@ "description": "Benchmark prefix." } }, + "additionalProperties": false, "description": "The account/benchmark parameter for SPAR calculation." }, "SPARBenchmark": { @@ -38626,7 +39227,8 @@ }, "description": "List of SPAR identifiers" } - } + }, + "additionalProperties": false }, "SPARBenchmarkRoot": { "required": [ @@ -38637,10 +39239,9 @@ "data": { "$ref": "#/components/schemas/SPARBenchmark" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "ConstraintAction": { "type": "object", @@ -38655,7 +39256,8 @@ ], "type": "string" } - } + }, + "additionalProperties": false }, "BPMOptimizerStrategyAlphaOverride": { "type": "object", @@ -38676,7 +39278,8 @@ "returnMultiplier": { "type": "string" } - } + }, + "additionalProperties": false }, "BPMOptimizerStrategyOverrides": { "type": "object", @@ -38699,7 +39302,8 @@ "type": "string", "description": "Transaction cost\r\nCan be set to \"\" for local" } - } + }, + "additionalProperties": false }, "BPMOptimizerStrategy": { "required": [ @@ -38714,7 +39318,8 @@ "type": "string", "description": "OptimizerStrategy document path" } - } + }, + "additionalProperties": false }, "BPMOptimization": { "type": "object", @@ -38739,7 +39344,8 @@ "type": "string", "description": "Cash flow" } - } + }, + "additionalProperties": false }, "BPMOptimizationParameters": { "required": [ @@ -38760,7 +39366,8 @@ "outputTypes": { "$ref": "#/components/schemas/OptimizerOutputTypes" } - } + }, + "additionalProperties": false }, "BPMOptimizationParametersRoot": { "type": "object", @@ -38771,7 +39378,8 @@ "meta": { "$ref": "#/components/schemas/OptimizerCalculationMeta" } - } + }, + "additionalProperties": false }, "ColumnSummary": { "type": "object", @@ -38789,6 +39397,7 @@ "description": "Column Category" } }, + "additionalProperties": false, "description": "Column settings (name, directory, category)" }, "ColumnSummaryRoot": { @@ -38803,10 +39412,9 @@ "$ref": "#/components/schemas/ColumnSummary" } }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "Column": { "type": "object", @@ -38830,7 +39438,8 @@ "type": "string", "description": "Column Category" } - } + }, + "additionalProperties": false }, "ColumnRoot": { "required": [ @@ -38841,10 +39450,9 @@ "data": { "$ref": "#/components/schemas/Column" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "ColumnStatistic": { "type": "object", @@ -38853,7 +39461,8 @@ "type": "string", "description": "Column Statistic Name" } - } + }, + "additionalProperties": false }, "ColumnStatisticRoot": { "required": [ @@ -38867,10 +39476,9 @@ "$ref": "#/components/schemas/ColumnStatistic" } }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "ComponentSummary": { "type": "object", @@ -38882,12 +39490,9 @@ "category": { "type": "string", "description": "Component category." - }, - "type": { - "type": "string", - "description": "Component type." } - } + }, + "additionalProperties": false }, "ComponentSummaryRoot": { "required": [ @@ -38901,10 +39506,9 @@ "$ref": "#/components/schemas/ComponentSummary" } }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "PAIdentifier": { "required": [ @@ -38920,7 +39524,8 @@ "type": "string", "description": "Holdings Mode can be B&H, TBR, OMS or EXT." } - } + }, + "additionalProperties": false }, "PADateParameters": { "required": [ @@ -38942,6 +39547,7 @@ "description": "Calculation's frequency." } }, + "additionalProperties": false, "description": "The date parameters for PA calculation." }, "PAComponent": { @@ -38975,6 +39581,10 @@ "type": "boolean", "description": "Is the component type snapshot or subperiod." }, + "path": { + "type": "string", + "description": "The path to the document" + }, "name": { "type": "string", "description": "Component name." @@ -38982,12 +39592,9 @@ "category": { "type": "string", "description": "Component category." - }, - "type": { - "type": "string", - "description": "Component type." } - } + }, + "additionalProperties": false }, "PAComponentRoot": { "required": [ @@ -38998,10 +39605,9 @@ "data": { "$ref": "#/components/schemas/PAComponent" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "VaultIdentifier": { "required": [ @@ -39014,6 +39620,7 @@ "description": "User's FactSet account path OR benchmark." } }, + "additionalProperties": false, "description": "The account/benchmark parameter for Vault calculation." }, "VaultDateParameters": { @@ -39036,6 +39643,7 @@ "description": "Calculation's frequency." } }, + "additionalProperties": false, "description": "The date parameters for Vault calculation" }, "VaultComponent": { @@ -39062,6 +39670,10 @@ "type": "boolean", "description": "Snapshot" }, + "path": { + "type": "string", + "description": "The path to the document" + }, "name": { "type": "string", "description": "Component name." @@ -39069,12 +39681,9 @@ "category": { "type": "string", "description": "Component category." - }, - "type": { - "type": "string", - "description": "Component type." } - } + }, + "additionalProperties": false }, "VaultComponentRoot": { "required": [ @@ -39085,10 +39694,9 @@ "data": { "$ref": "#/components/schemas/VaultComponent" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "VaultConfigurationSummary": { "type": "object", @@ -39097,7 +39705,8 @@ "type": "string", "description": "Configuration name." } - } + }, + "additionalProperties": false }, "VaultConfigurationSummaryRoot": { "required": [ @@ -39111,10 +39720,9 @@ "$ref": "#/components/schemas/VaultConfigurationSummary" } }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "ConfigurationAccount": { "type": "object", @@ -39143,7 +39751,8 @@ "type": "string", "description": "Account name." } - } + }, + "additionalProperties": false }, "VaultConfiguration": { "type": "object", @@ -39158,7 +39767,8 @@ "$ref": "#/components/schemas/ConfigurationAccount" } } - } + }, + "additionalProperties": false }, "VaultConfigurationRoot": { "required": [ @@ -39169,10 +39779,9 @@ "data": { "$ref": "#/components/schemas/VaultConfiguration" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "Currency": { "type": "object", @@ -39181,7 +39790,8 @@ "type": "string", "description": "Name of currency." } - } + }, + "additionalProperties": false }, "CurrencyRoot": { "required": [ @@ -39195,10 +39805,9 @@ "$ref": "#/components/schemas/Currency" } }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "DateParametersSummary": { "type": "object", @@ -39211,7 +39820,8 @@ "type": "string", "description": "End date in YYYYMMDD format." } - } + }, + "additionalProperties": false }, "DateParametersSummaryRoot": { "required": [ @@ -39222,10 +39832,9 @@ "data": { "$ref": "#/components/schemas/DateParametersSummary" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "DocumentDirectories": { "type": "object", @@ -39244,7 +39853,8 @@ }, "description": "List of directories." } - } + }, + "additionalProperties": false }, "DocumentDirectoriesRoot": { "required": [ @@ -39255,10 +39865,9 @@ "data": { "$ref": "#/components/schemas/DocumentDirectories" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "FIABIdentifier": { "required": [ @@ -39270,7 +39879,8 @@ "type": "string", "description": "User's FactSet account path." } - } + }, + "additionalProperties": false }, "FIABDateParameters": { "required": [ @@ -39288,6 +39898,7 @@ "description": "Calculation's end date." } }, + "additionalProperties": false, "description": "The date parameters for FIAB calculations." }, "FIABCalculationParameters": { @@ -39315,7 +39926,8 @@ "type": "string", "description": "FISettingsDocument (optional) - The given @FIS document will be used to\r\nconfigure analytics assumptions and settings. Expects a GUI-style path (Client:/foo/bar)" } - } + }, + "additionalProperties": false }, "FIABCalculationStatusSummary": { "type": "object", @@ -39330,7 +39942,8 @@ "description": "Last poll time of calculation.", "format": "date-time" } - } + }, + "additionalProperties": false }, "EventSummary": { "type": "object", @@ -39348,7 +39961,8 @@ "type": "string", "description": "Event's type" } - } + }, + "additionalProperties": false }, "FIABCalculationStatus": { "type": "object", @@ -39391,7 +40005,68 @@ }, "description": "List of batch events" } - } + }, + "additionalProperties": false + }, + "FIReferencePrepay": { + "type": "object", + "properties": { + "prepayName": { + "type": "string", + "description": "Reference Prepay Name" + } + }, + "additionalProperties": false + }, + "FIReferenceSecurity": { + "type": "object", + "properties": { + "securityType": { + "type": "string", + "description": "Reference Security Type" + }, + "securityName": { + "type": "string", + "description": "Reference Security Name" + }, + "calcFromMethod": { + "type": "string", + "description": "Reference Calculation Method.\r\nMethods : Active Spread, Actual Spread, Actual Spread To Worst Call, OAS, Price, Yield, Yield To No Call, Act/Act Yield To No Call, Bond Equivalent Yield,\r\nYield To Worst Call, Discount Yield, Discount Margin, Implied Volatility, Bullet Spread, Bullet Spread To Worst Call, Pricing Matrix" + }, + "calcFromValue": { + "type": "number", + "description": "Reference CalcFromValue", + "format": "double" + }, + "prepay": { + "$ref": "#/components/schemas/FIReferencePrepay" + }, + "settlement": { + "type": "string", + "description": "Reference Settlement Date" + } + }, + "additionalProperties": false + }, + "FILoss": { + "type": "object", + "properties": { + "lossName": { + "type": "string", + "description": "Loss Name" + } + }, + "additionalProperties": false + }, + "FIPrepay": { + "type": "object", + "properties": { + "prepayName": { + "type": "string", + "description": "Prepay Name" + } + }, + "additionalProperties": false }, "FISecurity": { "required": [ @@ -39414,9 +40089,28 @@ "type": "string", "description": "Call Method" }, + "referenceSecurity": { + "$ref": "#/components/schemas/FIReferenceSecurity" + }, + "loss": { + "$ref": "#/components/schemas/FILoss" + }, + "prepay": { + "$ref": "#/components/schemas/FIPrepay" + }, + "matrixSpreadAdjustment": { + "type": "number", + "description": "Matrix Spread Adjustment", + "format": "double" + }, + "matrixMultiplier": { + "type": "number", + "description": "Matrix Multiplier", + "format": "double" + }, "calcFromMethod": { "type": "string", - "description": "Calculation from method" + "description": "Calculation Method.\r\nMethods : Active Spread, Actual Spread, Actual Spread To Worst Call, OAS, Price, Yield, Yield To No Call, Act/Act Yield To No Call, Bond Equivalent Yield,\r\nYield To Worst Call, Discount Yield, Discount Margin, Implied Volatility, Bullet Spread, Bullet Spread To Worst Call, Pricing Matrix" }, "calcFromValue": { "type": "number", @@ -39446,7 +40140,8 @@ "type": "string", "description": "Discount curve" } - } + }, + "additionalProperties": false }, "FIJobSettings": { "required": [ @@ -39482,9 +40177,10 @@ }, "calcFromMethod": { "type": "string", - "description": "Calculation from method" + "description": "Calculation Method.\r\nMethods : Active Spread, Actual Spread, Actual Spread To Worst Call, OAS, Price, Yield, Yield To No Call, Act/Act Yield To No Call, Bond Equivalent Yield,\r\nYield To Worst Call, Discount Yield, Discount Margin, Implied Volatility, Bullet Spread, Bullet Spread To Worst Call, Pricing Matrix" } - } + }, + "additionalProperties": false }, "FICalculationParameters": { "required": [ @@ -39511,7 +40207,8 @@ "jobSettings": { "$ref": "#/components/schemas/FIJobSettings" } - } + }, + "additionalProperties": false }, "CalculationMeta": { "type": "object", @@ -39561,7 +40258,8 @@ "type": "string", "default": "JsonStach" } - } + }, + "additionalProperties": false }, "FICalculationParametersRoot": { "type": "object", @@ -39572,7 +40270,8 @@ "meta": { "$ref": "#/components/schemas/CalculationMeta" } - } + }, + "additionalProperties": false }, "PaDoc": { "required": [ @@ -39584,7 +40283,8 @@ "type": "string", "description": "PA document path" } - } + }, + "additionalProperties": false }, "FPOAccount": { "required": [ @@ -39602,14 +40302,33 @@ "overrides": { "$ref": "#/components/schemas/OptimizerAccountOverrides" } - } + }, + "additionalProperties": false }, - "OptimizerStrategyOverrides": { + "FPOObjective": { "type": "object", "properties": { - "tax": { - "type": "string", - "description": "Tax" + "active": { + "type": "string" + }, + "terms": { + "type": "object", + "additionalProperties": { + "enum": [ + "Disable", + "Enable" + ], + "type": "string" + } + } + }, + "additionalProperties": false + }, + "FPOOptimizerStrategyOverrides": { + "type": "object", + "properties": { + "objective": { + "$ref": "#/components/schemas/FPOObjective" }, "constraints": { "type": "object", @@ -39630,22 +40349,24 @@ "type": "string", "description": "Transaction cost" } - } + }, + "additionalProperties": false }, - "OptimizerStrategy": { + "FPOOptimizerStrategy": { "required": [ "id" ], "type": "object", "properties": { + "overrides": { + "$ref": "#/components/schemas/FPOOptimizerStrategyOverrides" + }, "id": { "type": "string", "description": "OptimizerStrategy document path" - }, - "overrides": { - "$ref": "#/components/schemas/OptimizerStrategyOverrides" } - } + }, + "additionalProperties": false }, "FPOOptimizationParameters": { "required": [ @@ -39658,7 +40379,7 @@ "$ref": "#/components/schemas/FPOAccount" }, "strategy": { - "$ref": "#/components/schemas/OptimizerStrategy" + "$ref": "#/components/schemas/FPOOptimizerStrategy" }, "optimization": { "$ref": "#/components/schemas/Optimization" @@ -39666,7 +40387,8 @@ "outputTypes": { "$ref": "#/components/schemas/OptimizerOutputTypes" } - } + }, + "additionalProperties": false }, "FPOOptimizationParametersRoot": { "type": "object", @@ -39677,7 +40399,8 @@ "meta": { "$ref": "#/components/schemas/OptimizerCalculationMeta" } - } + }, + "additionalProperties": false }, "Frequency": { "type": "object", @@ -39686,7 +40409,8 @@ "type": "string", "description": "Frequency name." } - } + }, + "additionalProperties": false }, "FrequencyRoot": { "required": [ @@ -39700,10 +40424,9 @@ "$ref": "#/components/schemas/Frequency" } }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "Group": { "type": "object", @@ -39720,7 +40443,8 @@ "type": "string", "description": "Group Category" } - } + }, + "additionalProperties": false }, "GroupRoot": { "required": [ @@ -39734,10 +40458,9 @@ "$ref": "#/components/schemas/Group" } }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "TemplateContentTypes": { "type": "object", @@ -39763,7 +40486,8 @@ }, "description": "Template locked fields" } - } + }, + "additionalProperties": false }, "LinkedPATemplateParameters": { "required": [ @@ -39787,7 +40511,8 @@ "content": { "$ref": "#/components/schemas/TemplateContentTypes" } - } + }, + "additionalProperties": false }, "LinkedPATemplateParametersRoot": { "required": [ @@ -39798,10 +40523,44 @@ "data": { "$ref": "#/components/schemas/LinkedPATemplateParameters" }, - "meta": { - "type": "object" + "meta": { } + }, + "additionalProperties": false + }, + "LinkedPATemplatePostSummary": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Template id." + }, + "description": { + "type": "string", + "description": "Template description." + }, + "name": { + "type": "string", + "description": "Template name." + }, + "parentComponentId": { + "type": "string", + "description": "Template parent tile." } - } + }, + "additionalProperties": false + }, + "LinkedPATemplatePostSummaryRoot": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/LinkedPATemplatePostSummary" + }, + "meta": { } + }, + "additionalProperties": false }, "LinkedPATemplateSummary": { "type": "object", @@ -39818,7 +40577,8 @@ "type": "string", "description": "Template parent tile." } - } + }, + "additionalProperties": false }, "LinkedPATemplateSummaryRoot": { "required": [ @@ -39832,10 +40592,9 @@ "$ref": "#/components/schemas/LinkedPATemplateSummary" } }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "LinkedPATemplateUpdateParameters": { "type": "object", @@ -39851,7 +40610,8 @@ "content": { "$ref": "#/components/schemas/TemplateContentTypes" } - } + }, + "additionalProperties": false }, "LinkedPATemplateUpdateParametersRoot": { "required": [ @@ -39862,10 +40622,9 @@ "data": { "$ref": "#/components/schemas/LinkedPATemplateUpdateParameters" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "LinkedPATemplate": { "type": "object", @@ -39897,7 +40656,8 @@ "type": "string", "description": "Template parent tile." } - } + }, + "additionalProperties": false }, "LinkedPATemplateRoot": { "required": [ @@ -39908,19 +40668,16 @@ "data": { "$ref": "#/components/schemas/LinkedPATemplate" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "NPOOptimizerStrategyOverrides": { "type": "object", "properties": { "objective": { "type": "object", - "additionalProperties": { - "type": "object" - }, + "additionalProperties": { }, "description": "Objective parameters" }, "constraints": { @@ -39942,7 +40699,8 @@ "type": "string", "description": "Alpha" } - } + }, + "additionalProperties": false }, "NPOOptimizerStrategy": { "required": [ @@ -39957,7 +40715,8 @@ "type": "string", "description": "OptimizerStrategy document path" } - } + }, + "additionalProperties": false }, "NPOOptimizationParameters": { "required": [ @@ -39978,7 +40737,8 @@ "outputTypes": { "$ref": "#/components/schemas/OptimizerOutputTypes" } - } + }, + "additionalProperties": false }, "NPOOptimizationParametersRoot": { "type": "object", @@ -39989,7 +40749,8 @@ "meta": { "$ref": "#/components/schemas/OptimizerCalculationMeta" } - } + }, + "additionalProperties": false }, "PACalculationGroup": { "type": "object", @@ -39998,7 +40759,8 @@ "type": "string", "description": "FactSet-defined or User-defined Group identifier." } - } + }, + "additionalProperties": false }, "PACalculationColumn": { "type": "object", @@ -40014,7 +40776,8 @@ }, "description": "Column Statistic identifier" } - } + }, + "additionalProperties": false }, "PACalculationParameters": { "required": [ @@ -40063,9 +40826,10 @@ }, "componentdetail": { "type": "string", - "description": "Component detail type for the PA component. It can be GROUPS or TOTALS." + "description": "Component detail type for the PA component. It can be GROUPS or TOTALS or SECURITIES." } - } + }, + "additionalProperties": false }, "PACalculationParametersRoot": { "type": "object", @@ -40080,7 +40844,8 @@ "meta": { "$ref": "#/components/schemas/CalculationMeta" } - } + }, + "additionalProperties": false }, "CalculationUnitStatus": { "type": "object", @@ -40111,7 +40876,8 @@ "type": "string", "description": "The progress of the calculation unit." } - } + }, + "additionalProperties": false }, "CalculationStatus": { "type": "object", @@ -40137,7 +40903,8 @@ }, "description": "Number of calculation units in batch." } - } + }, + "additionalProperties": false }, "CalculationUnitStatusMeta": { "type": "object", @@ -40146,7 +40913,8 @@ "type": "string", "description": "The Info URL of the calculation." } - } + }, + "additionalProperties": false }, "CalculationStatusMeta": { "type": "object", @@ -40158,7 +40926,8 @@ }, "description": "Meta of calculation units in batch." } - } + }, + "additionalProperties": false }, "CalculationStatusRoot": { "required": [ @@ -40172,7 +40941,8 @@ "meta": { "$ref": "#/components/schemas/CalculationStatusMeta" } - } + }, + "additionalProperties": false }, "PubIdentifier": { "required": [ @@ -40188,7 +40958,8 @@ "type": "string", "description": "Holdings Mode can be B&H, TBR, OMS or EXT." } - } + }, + "additionalProperties": false }, "PubDateParameters": { "required": [ @@ -40205,6 +40976,7 @@ "description": "Calculation's end date or as of date." } }, + "additionalProperties": false, "description": "The date parameters for Publisher calculation." }, "PubCalculationParameters": { @@ -40225,10 +40997,12 @@ "dates": { "$ref": "#/components/schemas/PubDateParameters" } - } + }, + "additionalProperties": false }, "PubCalculationMeta": { - "type": "object" + "type": "object", + "additionalProperties": false }, "PubCalculationParametersRoot": { "type": "object", @@ -40243,7 +41017,8 @@ "meta": { "$ref": "#/components/schemas/PubCalculationMeta" } - } + }, + "additionalProperties": false }, "QuantScreeningExpressionUniverse": { "required": [ @@ -40251,6 +41026,11 @@ "universeType" ], "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/QuantUniverse" + } + ], "properties": { "universeExpr": { "type": "string" @@ -40265,20 +41045,275 @@ "securityExpr": { "type": "string" } - } + }, + "additionalProperties": false + }, + "QuantIdentifierUniverse": { + "required": [ + "identifiers", + "universeType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/QuantUniverse" + } + ], + "properties": { + "universeType": { + "enum": [ + "Equity", + "Debt" + ], + "type": "string" + }, + "identifiers": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "QuantUniverse": { + "required": [ + "source" + ], + "type": "object", + "properties": { + "source": { + "enum": [ + "ScreeningExpressionUniverse", + "UniversalScreenUniverse", + "IdentifierUniverse" + ], + "type": "string" + } + }, + "additionalProperties": false }, "QuantUniversalScreenUniverse": { "required": [ "screen" ], "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/QuantUniverse" + } + ], "properties": { "screen": { "type": "string" } - } + }, + "additionalProperties": false }, - "QuantIdentifierUniverse": { + "QuantDateList": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/QuantDate" + } + ], + "properties": { + "dates": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "QuantDate": { + "required": [ + "calendar", + "frequency", + "source" + ], + "type": "object", + "properties": { + "source": { + "enum": [ + "FdsDate", + "DateList" + ], + "type": "string" + }, + "frequency": { + "type": "string" + }, + "calendar": { + "type": "string" + } + }, + "additionalProperties": false + }, + "QuantFdsDate": { + "required": [ + "endDate", + "startDate" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/QuantDate" + } + ], + "properties": { + "startDate": { + "type": "string" + }, + "endDate": { + "type": "string" + } + }, + "additionalProperties": false + }, + "QuantFqlExpression": { + "required": [ + "expr", + "name" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/QuantFormula" + } + ], + "properties": { + "expr": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false + }, + "QuantUniversalScreenParameter": { + "required": [ + "name", + "referenceName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/QuantFormula" + } + ], + "properties": { + "referenceName": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false + }, + "QuantAllUniversalScreenParameters": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/QuantFormula" + } + ], + "additionalProperties": false + }, + "QuantFormula": { + "required": [ + "source" + ], + "type": "object", + "properties": { + "source": { + "enum": [ + "ScreeningExpression", + "FqlExpression", + "UniversalScreenParameter", + "AllUniversalScreenParameters" + ], + "type": "string" + } + }, + "additionalProperties": false + }, + "QuantScreeningExpression": { + "required": [ + "expr", + "name" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/QuantFormula" + } + ], + "properties": { + "expr": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false + }, + "QuantScreeningExpressionUniverseObsolete": { + "required": [ + "universeExpr", + "universeType" + ], + "type": "object", + "properties": { + "universeExpr": { + "type": "string" + }, + "universeType": { + "enum": [ + "Equity", + "Debt" + ], + "type": "string" + }, + "securityExpr": { + "type": "string" + }, + "source": { + "enum": [ + "ScreeningExpressionUniverse", + "UniversalScreenUniverse", + "IdentifierUniverse" + ], + "type": "string" + } + }, + "additionalProperties": false + }, + "QuantUniversalScreenUniverseObsolete": { + "required": [ + "screen" + ], + "type": "object", + "properties": { + "screen": { + "type": "string" + }, + "source": { + "enum": [ + "ScreeningExpressionUniverse", + "UniversalScreenUniverse", + "IdentifierUniverse" + ], + "type": "string" + } + }, + "additionalProperties": false + }, + "QuantIdentifierUniverseObsolete": { "required": [ "identifiers", "universeType" @@ -40297,10 +41332,19 @@ "items": { "type": "string" } + }, + "source": { + "enum": [ + "ScreeningExpressionUniverse", + "UniversalScreenUniverse", + "IdentifierUniverse" + ], + "type": "string" } - } + }, + "additionalProperties": false }, - "QuantFdsDate": { + "QuantFdsDateObsolete": { "required": [ "calendar", "endDate", @@ -40321,9 +41365,10 @@ "calendar": { "type": "string" } - } + }, + "additionalProperties": false }, - "QuantDateList": { + "QuantDateListObsolete": { "required": [ "calendar", "frequency" @@ -40342,9 +41387,10 @@ "calendar": { "type": "string" } - } + }, + "additionalProperties": false }, - "QuantScreeningExpression": { + "QuantScreeningExpressionObsolete": { "required": [ "expr", "name" @@ -40357,9 +41403,10 @@ "name": { "type": "string" } - } + }, + "additionalProperties": false }, - "QuantFqlExpression": { + "QuantFqlExpressionObsolete": { "required": [ "expr", "name" @@ -40372,9 +41419,10 @@ "name": { "type": "string" } - } + }, + "additionalProperties": false }, - "QuantUniversalScreenParameter": { + "QuantUniversalScreenParameterObsolete": { "required": [ "name", "referenceName" @@ -40387,54 +41435,84 @@ "name": { "type": "string" } - } + }, + "additionalProperties": false }, - "QuantAllUniversalScreenParameters": { - "type": "object" + "QuantAllUniversalScreenParametersObsolete": { + "type": "object", + "additionalProperties": false }, "QuantCalculationParameters": { "type": "object", "properties": { - "screeningExpressionUniverse": { - "$ref": "#/components/schemas/QuantScreeningExpressionUniverse" - }, - "universalScreenUniverse": { - "$ref": "#/components/schemas/QuantUniversalScreenUniverse" - }, - "identifierUniverse": { - "$ref": "#/components/schemas/QuantIdentifierUniverse" - }, - "fdsDate": { - "$ref": "#/components/schemas/QuantFdsDate" - }, - "dateList": { - "$ref": "#/components/schemas/QuantDateList" - }, - "screeningExpression": { - "type": "array", - "items": { - "$ref": "#/components/schemas/QuantScreeningExpression" - } - }, - "fqlExpression": { - "type": "array", - "items": { - "$ref": "#/components/schemas/QuantFqlExpression" + "universe": { + "oneOf": [ + { + "$ref": "#/components/schemas/QuantUniversalScreenUniverse" + }, + { + "$ref": "#/components/schemas/QuantScreeningExpressionUniverse" + }, + { + "$ref": "#/components/schemas/QuantIdentifierUniverse" + } + ], + "discriminator": { + "propertyName": "source", + "mapping": { + "UniversalScreenUniverse": "#/components/schemas/QuantUniversalScreenUniverse", + "ScreeningExpressionUniverse": "#/components/schemas/QuantScreeningExpressionUniverse", + "IdentifierUniverse": "#/components/schemas/QuantIdentifierUniverse" + } } }, - "universalScreenParameter": { - "type": "array", - "items": { - "$ref": "#/components/schemas/QuantUniversalScreenParameter" + "dates": { + "oneOf": [ + { + "$ref": "#/components/schemas/QuantFdsDate" + }, + { + "$ref": "#/components/schemas/QuantDateList" + } + ], + "discriminator": { + "propertyName": "source", + "mapping": { + "FdsDate": "#/components/schemas/QuantFdsDate", + "DateList": "#/components/schemas/QuantDateList" + } } }, - "allUniversalScreenParameters": { + "formulas": { "type": "array", "items": { - "$ref": "#/components/schemas/QuantAllUniversalScreenParameters" + "oneOf": [ + { + "$ref": "#/components/schemas/QuantScreeningExpression" + }, + { + "$ref": "#/components/schemas/QuantFqlExpression" + }, + { + "$ref": "#/components/schemas/QuantUniversalScreenParameter" + }, + { + "$ref": "#/components/schemas/QuantAllUniversalScreenParameters" + } + ], + "discriminator": { + "propertyName": "source", + "mapping": { + "ScreeningExpression": "#/components/schemas/QuantScreeningExpression", + "FqlExpression": "#/components/schemas/QuantFqlExpression", + "UniversalScreenParameter": "#/components/schemas/QuantUniversalScreenParameter", + "AllUniversalScreenParameters": "#/components/schemas/QuantAllUniversalScreenParameters" + } + } } } - } + }, + "additionalProperties": false }, "QuantCalculationMeta": { "type": "object", @@ -40487,7 +41565,8 @@ "type": "string", "default": "JsonStach" } - } + }, + "additionalProperties": false }, "QuantCalculationParametersRoot": { "type": "object", @@ -40502,7 +41581,8 @@ "meta": { "$ref": "#/components/schemas/QuantCalculationMeta" } - } + }, + "additionalProperties": false }, "SPARDateParameters": { "required": [ @@ -40525,6 +41605,7 @@ "description": "Calculation's frequency." } }, + "additionalProperties": false, "description": "The date parameters for SPAR calculation." }, "SPARCalculationParameters": { @@ -40554,7 +41635,8 @@ "type": "string", "description": "Currency ISO code for calculation." } - } + }, + "additionalProperties": false }, "SPARCalculationParametersRoot": { "type": "object", @@ -40569,7 +41651,8 @@ "meta": { "$ref": "#/components/schemas/CalculationMeta" } - } + }, + "additionalProperties": false }, "PAComponentData": { "type": "object", @@ -40613,7 +41696,8 @@ "type": "string", "description": "PA Storage type. It can be GROUPS or TOTALS or SECURITIES." } - } + }, + "additionalProperties": false }, "TemplatedPAComponentParameters": { "required": [ @@ -40637,7 +41721,8 @@ "componentData": { "$ref": "#/components/schemas/PAComponentData" } - } + }, + "additionalProperties": false }, "TemplatedPAComponentParametersRoot": { "required": [ @@ -40648,10 +41733,43 @@ "data": { "$ref": "#/components/schemas/TemplatedPAComponentParameters" }, - "meta": { - "type": "object" + "meta": { } + }, + "additionalProperties": false + }, + "TemplatedPAComponentPostSummary": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "parentTemplateId": { + "type": "string" + }, + "type": { + "type": "string" } - } + }, + "additionalProperties": false + }, + "TemplatedPAComponentPostSummaryRoot": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/TemplatedPAComponentPostSummary" + }, + "meta": { } + }, + "additionalProperties": false }, "TemplatedPAComponentSummary": { "type": "object", @@ -40668,7 +41786,8 @@ "type": { "type": "string" } - } + }, + "additionalProperties": false }, "TemplatedPAComponentSummaryRoot": { "required": [ @@ -40682,10 +41801,9 @@ "$ref": "#/components/schemas/TemplatedPAComponentSummary" } }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "TemplatedPAComponentUpdateParameters": { "type": "object", @@ -40701,7 +41819,8 @@ "componentData": { "$ref": "#/components/schemas/PAComponentData" } - } + }, + "additionalProperties": false }, "TemplatedPAComponentUpdateParametersRoot": { "required": [ @@ -40712,10 +41831,52 @@ "data": { "$ref": "#/components/schemas/TemplatedPAComponentUpdateParameters" }, - "meta": { - "type": "object" + "meta": { } + }, + "additionalProperties": false + }, + "TemplatedPAComponent": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "directory": { + "type": "string" + }, + "snapshot": { + "type": "boolean" + }, + "componentData": { + "$ref": "#/components/schemas/PAComponentData" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "parentTemplateId": { + "type": "string" + }, + "type": { + "type": "string" } - } + }, + "additionalProperties": false + }, + "TemplatedPAComponentRoot": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/TemplatedPAComponent" + }, + "meta": { } + }, + "additionalProperties": false }, "UnlinkedPATemplateParameters": { "required": [ @@ -40778,7 +41939,8 @@ "content": { "$ref": "#/components/schemas/TemplateContentTypes" } - } + }, + "additionalProperties": false }, "UnlinkedPATemplateParametersRoot": { "required": [ @@ -40789,24 +41951,62 @@ "data": { "$ref": "#/components/schemas/UnlinkedPATemplateParameters" }, - "meta": { - "type": "object" + "meta": { } + }, + "additionalProperties": false + }, + "UnlinkedPATemplatePostSummary": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Template id." + }, + "description": { + "type": "string", + "description": "Template description." + }, + "name": { + "type": "string", + "description": "Template name." + }, + "category": { + "type": "string", + "description": "Unlinked template category" } - } + }, + "additionalProperties": false + }, + "UnlinkedPATemplatePostSummaryRoot": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/UnlinkedPATemplatePostSummary" + }, + "meta": { } + }, + "additionalProperties": false }, "UnlinkedPATemplateSummary": { "type": "object", "properties": { "description": { - "type": "string" + "type": "string", + "description": "Template description." }, "name": { - "type": "string" + "type": "string", + "description": "Template name." }, "category": { - "type": "string" + "type": "string", + "description": "Unlinked template category" } - } + }, + "additionalProperties": false }, "UnlinkedPATemplateSummaryRoot": { "required": [ @@ -40820,10 +42020,9 @@ "$ref": "#/components/schemas/UnlinkedPATemplateSummary" } }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "UnlinkedPATemplateUpdateParameters": { "type": "object", @@ -40874,7 +42073,8 @@ "content": { "$ref": "#/components/schemas/TemplateContentTypes" } - } + }, + "additionalProperties": false }, "UnlinkedPATemplateUpdateParametersRoot": { "required": [ @@ -40885,43 +42085,49 @@ "data": { "$ref": "#/components/schemas/UnlinkedPATemplateUpdateParameters" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "UnlinkedPATemplate": { "type": "object", "properties": { - "directory": { - "type": "string" - }, "id": { - "type": "string" + "type": "string", + "description": "Template id." + }, + "directory": { + "type": "string", + "description": "Template directory." }, "templateTypeId": { - "type": "string" + "type": "string", + "description": "Template type id" }, "snapshot": { - "type": "boolean" + "type": "boolean", + "description": "snapshot." }, "accounts": { "type": "array", "items": { "$ref": "#/components/schemas/PAIdentifier" - } + }, + "description": "List of accounts" }, "benchmarks": { "type": "array", "items": { "$ref": "#/components/schemas/PAIdentifier" - } + }, + "description": "List of benchmarks" }, "columns": { "type": "array", "items": { "$ref": "#/components/schemas/PACalculationColumn" - } + }, + "description": "List of columns for the PA calculation" }, "dates": { "$ref": "#/components/schemas/PADateParameters" @@ -40930,27 +42136,34 @@ "type": "array", "items": { "$ref": "#/components/schemas/PACalculationGroup" - } + }, + "description": "List of groupings for the PA calculation" }, "currencyisocode": { - "type": "string" + "type": "string", + "description": "Currency ISO code for calculation." }, "componentdetail": { - "type": "string" + "type": "string", + "description": "PA storage type. It can be GROUPS or TOTALS or SECURITIES." }, "content": { "$ref": "#/components/schemas/TemplateContentTypes" }, "description": { - "type": "string" + "type": "string", + "description": "Template description." }, "name": { - "type": "string" + "type": "string", + "description": "Template name." }, "category": { - "type": "string" + "type": "string", + "description": "Unlinked template category" } - } + }, + "additionalProperties": false }, "UnlinkedPATemplateRoot": { "required": [ @@ -40961,10 +42174,9 @@ "data": { "$ref": "#/components/schemas/UnlinkedPATemplate" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "UnlinkedPATemplateCategoryAndType": { "type": "object", @@ -40977,7 +42189,8 @@ "type": "string", "description": "Unlinked template type" } - } + }, + "additionalProperties": false }, "UnlinkedPATemplateCategoryAndTypeRoot": { "required": [ @@ -40991,10 +42204,9 @@ "$ref": "#/components/schemas/UnlinkedPATemplateCategoryAndType" } }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "UnlinkedPATemplateCategoryAndTypeDetails": { "type": "object", @@ -41011,7 +42223,8 @@ "type": "string", "description": "Unlinked template type" } - } + }, + "additionalProperties": false }, "UnlinkedPATemplateCategoryAndTypeDetailsRoot": { "required": [ @@ -41022,10 +42235,9 @@ "data": { "$ref": "#/components/schemas/UnlinkedPATemplateCategoryAndTypeDetails" }, - "meta": { - "type": "object" - } - } + "meta": { } + }, + "additionalProperties": false }, "VaultCalculationParameters": { "required": [ @@ -41051,9 +42263,10 @@ }, "componentdetail": { "type": "string", - "description": "Component detail type for the Vault component. It can be GROUPS or TOTALS." + "description": "Component detail type for the Vault component. It can be GROUPS or TOTALS or SECURITIES." } - } + }, + "additionalProperties": false }, "VaultCalculationParametersRoot": { "type": "object", @@ -41068,7 +42281,8 @@ "meta": { "$ref": "#/components/schemas/CalculationMeta" } - } + }, + "additionalProperties": false } }, "securitySchemes": { From a12ee29e005e4237a928b00c218c6037049fbc35 Mon Sep 17 00:00:00 2001 From: Sai Giridhar P Date: Mon, 22 Nov 2021 19:33:17 +0530 Subject: [PATCH 02/12] fix(SDKs): Updated spec --- openapi-schema.json | 70 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/openapi-schema.json b/openapi-schema.json index 2167bc3..ff231fd 100644 --- a/openapi-schema.json +++ b/openapi-schema.json @@ -18325,7 +18325,7 @@ "LinkedPATemplates" ], "summary": "Create a linked PA template", - "description": "This endpoint creates a template from an **existing portfolio analysis tile**, allowing the user to replicate and fetch reports settings.\r\n\r\nRemarks:\r\n\r\n* Mandatory, optional and locked fields can be \"accounts\", \"benchmarks\", \"groups\", \"columns\", \"dates\", \"currencyisocode\" and \"componentdetail\".\r\n\r\n* Mandatory and locked strings are mutually exclusive.", + "description": "This endpoint creates a template from an **existing portfolio analysis tile**, allowing the user to replicate and fetch reports settings.\r\n\r\nRemarks:\r\n\r\n* Mandatory fields are required to be passed in POST requests and Optional fields are not necessary. \r\n If no mandatory fields are passed, then we can use the template as a component and skip the component creation.\r\n \r\n* Mandatory, optional and locked fields can be \"accounts\", \"benchmarks\", \"groups\", \"columns\", \"dates\", \"currencyisocode\" and \"componentdetail\".\r\n\r\n* We cannot override the Locked fields when creating the Component.\r\n\r\n* Mandatory and locked strings are mutually exclusive.\r\n\r\n* Multi-horizon frequencies are not supported through this endpoint.", "operationId": "createLinkedPATemplates", "requestBody": { "description": "Request Parameters", @@ -18970,7 +18970,7 @@ "LinkedPATemplates" ], "summary": "Update a linked PA template", - "description": "This endpoint allows the user to change the request body and description from an existing template.\r\n\r\nRemarks:\r\n\r\n* Mandatory, optional and locked fields can be \"accounts\", \"benchmarks\", \"groups\", \"columns\", \"dates\", \"currencyisocode\" and \"componentdetail\".\r\n\r\n* Mandatory and locked strings are mutually exclusive.", + "description": "This endpoint allows the user to change the request body and description from an existing template.\r\n\r\nRemarks:\r\n\r\n* Mandatory fields are required to be passed in POST requests and Optional fields are not necessary. \r\n If no mandatory fields are passed, then we can use the template as a component and skip the component creation.\r\n \r\n* Mandatory, optional and locked fields can be \"accounts\", \"benchmarks\", \"groups\", \"columns\", \"dates\", \"currencyisocode\" and \"componentdetail\".\r\n\r\n* We cannot override the Locked fields when creating the Component.\r\n\r\n* Mandatory and locked strings are mutually exclusive.\r\n\r\n* Multi-horizon frequencies are not supported through this endpoint.", "operationId": "updateLinkedPATemplates", "parameters": [ { @@ -32870,7 +32870,7 @@ "TemplatedPAComponents" ], "summary": "Create templated PA component", - "description": "This endpoint creates new component based off of linked PA template or unlinked PA template.", + "description": "This endpoint creates new component based off of linked PA template or unlinked PA template.\r\n\r\nRemarks:\r\n\r\n* Any settings in the POST body will act as a one-time override over the settings saved in the PA template.\r\n\r\n* Multi-horizon frequencies are not supported through this endpoint.\r\n\r\n* Componentdetail supports securities, groups, and totals as well but if we don't pass anything that defaults to securities.", "operationId": "createTemplatedPAComponents", "requestBody": { "description": "Request Parameters", @@ -33474,7 +33474,7 @@ "TemplatedPAComponents" ], "summary": "Update templated PA component", - "description": "This endpoint allows the user to change the request body from an existing templated PA component.", + "description": "This endpoint allows the user to change the request body from an existing templated PA component.\r\n\r\nRemarks:\r\n\r\n* Any settings in the POST body will act as a one-time override over the settings saved in the PA template.\r\n\r\n* Multi-horizon frequencies are not supported through this endpoint.\r\n\r\n* Componentdetail supports securities, groups, and totals as well but if we don't pass anything that defaults to securities.", "operationId": "updateTemplatedPAComponents", "parameters": [ { @@ -34451,7 +34451,7 @@ "UnlinkedPATemplates" ], "summary": "Create unlinked PA template", - "description": "This endpoint creates a template which is not linked to any specific PA3 tile. \r\n\r\nRemarks:\r\n\r\n* Mandatory, optional and locked fields can be \"accounts\", \"benchmarks\", \"groups\", \"columns\", \"dates\", \"currencyisocode\" and \"componentdetail\".\r\n\r\n* Mandatory and locked strings are mutually exclusive.", + "description": "This endpoint creates a template which is not linked to any specific PA3 tile. \r\n\r\nRemarks:\r\n\r\n* Mandatory fields are required to be passed in POST requests and Optional fields are not necessary. \r\n If no mandatory fields are passed, then we can use the template as a component and skip the component creation.\r\n \r\n* Mandatory, optional and locked fields can be \"accounts\", \"benchmarks\", \"groups\", \"columns\", \"dates\", \"currencyisocode\" and \"componentdetail\".\r\n\r\n* We cannot override the Locked fields when creating the Component.\r\n\r\n* Mandatory and locked strings are mutually exclusive.\r\n\r\n* Any settings in the POST body will act as a one-time override over the settings saved in the PA template.\r\n\r\n* Multi-horizon frequencies are not supported through this endpoint.\r\n\r\n* Componentdetail supports securities, groups, and totals as well but if we don't pass anything that defaults to securities.", "operationId": "createUnlinkedPATemplates", "requestBody": { "description": "Request Parameters", @@ -35006,7 +35006,7 @@ "UnlinkedPATemplates" ], "summary": "Update unlinked PA template", - "description": "This endpoint updates an existing unlinked PA template.\r\n\r\nRemarks:\r\n \r\n* Mandatory, optional and locked fields can be \"accounts\", \"benchmarks\", \"groups\", \"columns\", \"dates\", \"currencyisocode\" and \"componentdetail\".\r\n\r\n* Mandatory and locked strings are mutually exclusive.", + "description": "This endpoint updates an existing unlinked PA template.\r\n\r\nRemarks:\r\n \r\n* Mandatory fields are required to be passed in POST requests and Optional fields are not necessary. \r\n If no mandatory fields are passed, then we can use the template as a component and skip the component creation.\r\n \r\n* Mandatory, optional and locked fields can be \"accounts\", \"benchmarks\", \"groups\", \"columns\", \"dates\", \"currencyisocode\" and \"componentdetail\".\r\n\r\n* We cannot override the Locked fields when creating the Component.\r\n\r\n* Mandatory and locked strings are mutually exclusive.\r\n\r\n* Any settings in the POST body will act as a one-time override over the settings saved in the PA template.\r\n\r\n* Multi-horizon frequencies are not supported through this endpoint.\r\n\r\n* Componentdetail supports securities, groups, and totals as well but if we don't pass anything that defaults to securities.", "operationId": "updateUnlinkedPATemplates", "parameters": [ { @@ -40875,6 +40875,11 @@ "progress": { "type": "string", "description": "The progress of the calculation unit." + }, + "points": { + "type": "integer", + "description": "The points for the calculation unit.", + "format": "int32" } }, "additionalProperties": false @@ -42208,6 +42213,41 @@ }, "additionalProperties": false }, + "UnlinkedPATemplateColumnDetails": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Unlinked template column name" + }, + "id": { + "type": "string", + "description": "FactSet-defined or User-defined Column identifier." + }, + "statistics": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Column Statistic identifier" + } + }, + "additionalProperties": false + }, + "UnlinkedPATemplateGroupDetails": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Unlinked template group name" + }, + "id": { + "type": "string", + "description": "FactSet-defined or User-defined Group identifier." + } + }, + "additionalProperties": false + }, "UnlinkedPATemplateCategoryAndTypeDetails": { "type": "object", "properties": { @@ -42215,6 +42255,24 @@ "type": "string", "description": "Type Id" }, + "columns": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UnlinkedPATemplateColumnDetails" + }, + "description": "List of default columns" + }, + "groups": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UnlinkedPATemplateGroupDetails" + }, + "description": "List of default groupings" + }, + "snapshot": { + "type": "boolean", + "description": "Snapshot" + }, "category": { "type": "string", "description": "Unlinked template category" From 531c521e6781fed3f16cbbaf1ebdd89489d61a20 Mon Sep 17 00:00:00 2001 From: Sai Giridhar P Date: Wed, 24 Nov 2021 16:07:51 +0530 Subject: [PATCH 03/12] fix(mustache-files): Adding support for oneof functionality --- .../python/templates/model_utils.mustache | 1609 +++++++++++++++++ 1 file changed, 1609 insertions(+) create mode 100644 languages/python/templates/model_utils.mustache diff --git a/languages/python/templates/model_utils.mustache b/languages/python/templates/model_utils.mustache new file mode 100644 index 0000000..758cb0b --- /dev/null +++ b/languages/python/templates/model_utils.mustache @@ -0,0 +1,1609 @@ +{{! This file is picked from the v5.1.0 release of openapi-generator(https://github.com/OpenAPITools/openapi-generator/blob/v5.1.0/modules/openapi-generator/src/main/resources/python/model_utils.mustache) }} +{{! Changes made: 1) Made a change to support oneof in the Models at line 1062 }} + +{{>partial_header}} + +from datetime import date, datetime # noqa: F401 +import inspect +import io +import os +import pprint +import re +import tempfile + +from dateutil.parser import parse + +from {{packageName}}.exceptions import ( + ApiKeyError, + ApiAttributeError, + ApiTypeError, + ApiValueError, +) + +none_type = type(None) +file_type = io.IOBase + + +class cached_property(object): + # this caches the result of the function call for fn with no inputs + # use this as a decorator on fuction methods that you want converted + # into cached properties + result_key = '_results' + + def __init__(self, fn): + self._fn = fn + + def __get__(self, instance, cls=None): + if self.result_key in vars(self): + return vars(self)[self.result_key] + else: + result = self._fn() + setattr(self, self.result_key, result) + return result + + +PRIMITIVE_TYPES = (list, float, int, bool, datetime, date, str, file_type) + +def allows_single_value_input(cls): + """ + This function returns True if the input composed schema model or any + descendant model allows a value only input + This is true for cases where oneOf contains items like: + oneOf: + - float + - NumberWithValidation + - StringEnum + - ArrayModel + - null + TODO: lru_cache this + """ + if ( + issubclass(cls, ModelSimple) or + cls in PRIMITIVE_TYPES + ): + return True + elif issubclass(cls, ModelComposed): + if not cls._composed_schemas['oneOf']: + return False + return any(allows_single_value_input(c) for c in cls._composed_schemas['oneOf']) + return False + +def composed_model_input_classes(cls): + """ + This function returns a list of the possible models that can be accepted as + inputs. + TODO: lru_cache this + """ + if issubclass(cls, ModelSimple) or cls in PRIMITIVE_TYPES: + return [cls] + elif issubclass(cls, ModelNormal): + if cls.discriminator is None: + return [cls] + else: + return get_discriminated_classes(cls) + elif issubclass(cls, ModelComposed): + if not cls._composed_schemas['oneOf']: + return [] + if cls.discriminator is None: + input_classes = [] + for c in cls._composed_schemas['oneOf']: + input_classes.extend(composed_model_input_classes(c)) + return input_classes + else: + return get_discriminated_classes(cls) + return [] + + +class OpenApiModel(object): + """The base class for all OpenAPIModels""" + +{{> model_templates/method_set_attribute }} + +{{> model_templates/methods_shared }} + + def __new__(cls, *args, **kwargs): + # this function uses the discriminator to + # pick a new schema/class to instantiate because a discriminator + # propertyName value was passed in + + if len(args) == 1: + arg = args[0] + if arg is None and is_type_nullable(cls): + # The input data is the 'null' value and the type is nullable. + return None + + if issubclass(cls, ModelComposed) and allows_single_value_input(cls): + model_kwargs = {} + oneof_instance = get_oneof_instance(cls, model_kwargs, kwargs, model_arg=arg) + return oneof_instance + + + visited_composed_classes = kwargs.get('_visited_composed_classes', ()) + if ( + cls.discriminator is None or + cls in visited_composed_classes + ): + # Use case 1: this openapi schema (cls) does not have a discriminator + # Use case 2: we have already visited this class before and are sure that we + # want to instantiate it this time. We have visited this class deserializing + # a payload with a discriminator. During that process we traveled through + # this class but did not make an instance of it. Now we are making an + # instance of a composed class which contains cls in it, so this time make an instance of cls. + # + # Here's an example of use case 2: If Animal has a discriminator + # petType and we pass in "Dog", and the class Dog + # allOf includes Animal, we move through Animal + # once using the discriminator, and pick Dog. + # Then in the composed schema dog Dog, we will make an instance of the + # Animal class (because Dal has allOf: Animal) but this time we won't travel + # through Animal's discriminator because we passed in + # _visited_composed_classes = (Animal,) + + return super(OpenApiModel, cls).__new__(cls) + + # Get the name and value of the discriminator property. + # The discriminator name is obtained from the discriminator meta-data + # and the discriminator value is obtained from the input data. + discr_propertyname_py = list(cls.discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if discr_propertyname_js in kwargs: + discr_value = kwargs[discr_propertyname_js] + elif discr_propertyname_py in kwargs: + discr_value = kwargs[discr_propertyname_py] + else: + # The input data does not contain the discriminator property. + path_to_item = kwargs.get('_path_to_item', ()) + raise ApiValueError( + "Cannot deserialize input data due to missing discriminator. " + "The discriminator property '%s' is missing at path: %s" % + (discr_propertyname_js, path_to_item) + ) + + # Implementation note: the last argument to get_discriminator_class + # is a list of visited classes. get_discriminator_class may recursively + # call itself and update the list of visited classes, and the initial + # value must be an empty list. Hence not using 'visited_composed_classes' + new_cls = get_discriminator_class( + cls, discr_propertyname_py, discr_value, []) + if new_cls is None: + path_to_item = kwargs.get('_path_to_item', ()) + disc_prop_value = kwargs.get( + discr_propertyname_js, kwargs.get(discr_propertyname_py)) + raise ApiValueError( + "Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '%s'='%s' at path: %s" % + (discr_propertyname_js, disc_prop_value, path_to_item) + ) + + if new_cls in visited_composed_classes: + # if we are making an instance of a composed schema Descendent + # which allOf includes Ancestor, then Ancestor contains + # a discriminator that includes Descendent. + # So if we make an instance of Descendent, we have to make an + # instance of Ancestor to hold the allOf properties. + # This code detects that use case and makes the instance of Ancestor + # For example: + # When making an instance of Dog, _visited_composed_classes = (Dog,) + # then we make an instance of Animal to include in dog._composed_instances + # so when we are here, cls is Animal + # cls.discriminator != None + # cls not in _visited_composed_classes + # new_cls = Dog + # but we know we know that we already have Dog + # because it is in visited_composed_classes + # so make Animal here + return super(OpenApiModel, cls).__new__(cls) + + # Build a list containing all oneOf and anyOf descendants. + oneof_anyof_classes = None + if cls._composed_schemas is not None: + oneof_anyof_classes = ( + cls._composed_schemas.get('oneOf', ()) + + cls._composed_schemas.get('anyOf', ())) + oneof_anyof_child = new_cls in oneof_anyof_classes + kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,) + + if cls._composed_schemas.get('allOf') and oneof_anyof_child: + # Validate that we can make self because when we make the + # new_cls it will not include the allOf validations in self + self_inst = super(OpenApiModel, cls).__new__(cls) + self_inst.__init__(*args, **kwargs) + + new_inst = new_cls.__new__(new_cls, *args, **kwargs) + new_inst.__init__(*args, **kwargs) + return new_inst + + +class ModelSimple(OpenApiModel): + """the parent class of models whose type != object in their + swagger/openapi""" + +{{> model_templates/methods_setattr_getattr_normal }} + +{{> model_templates/methods_tostr_eq_simple }} + + +class ModelNormal(OpenApiModel): + """the parent class of models whose type == object in their + swagger/openapi""" + +{{> model_templates/methods_setattr_getattr_normal }} + +{{> model_templates/methods_todict_tostr_eq_shared}} + + +class ModelComposed(OpenApiModel): + """the parent class of models whose type == object in their + swagger/openapi and have oneOf/allOf/anyOf + + When one sets a property we use var_name_to_model_instances to store the value in + the correct class instances + run any type checking + validation code. + When one gets a property we use var_name_to_model_instances to get the value + from the correct class instances. + This allows multiple composed schemas to contain the same property with additive + constraints on the value. + + _composed_schemas (dict) stores the anyOf/allOf/oneOf classes + key (str): allOf/oneOf/anyOf + value (list): the classes in the XOf definition. + Note: none_type can be included when the openapi document version >= 3.1.0 + _composed_instances (list): stores a list of instances of the composed schemas + defined in _composed_schemas. When properties are accessed in the self instance, + they are returned from the self._data_store or the data stores in the instances + in self._composed_schemas + _var_name_to_model_instances (dict): maps between a variable name on self and + the composed instances (self included) which contain that data + key (str): property name + value (list): list of class instances, self or instances in _composed_instances + which contain the value that the key is referring to. + """ + +{{> model_templates/methods_setattr_getattr_composed }} + +{{> model_templates/methods_todict_tostr_eq_shared}} + + +COERCION_INDEX_BY_TYPE = { + ModelComposed: 0, + ModelNormal: 1, + ModelSimple: 2, + none_type: 3, # The type of 'None'. + list: 4, + dict: 5, + float: 6, + int: 7, + bool: 8, + datetime: 9, + date: 10, + str: 11, + file_type: 12, # 'file_type' is an alias for the built-in 'file' or 'io.IOBase' type. +} + +# these are used to limit what type conversions we try to do +# when we have a valid type already and we want to try converting +# to another type +UPCONVERSION_TYPE_PAIRS = ( + (str, datetime), + (str, date), + (int, float), # A float may be serialized as an integer, e.g. '3' is a valid serialized float. + (list, ModelComposed), + (dict, ModelComposed), + (str, ModelComposed), + (int, ModelComposed), + (float, ModelComposed), + (list, ModelComposed), + (list, ModelNormal), + (dict, ModelNormal), + (str, ModelSimple), + (int, ModelSimple), + (float, ModelSimple), + (list, ModelSimple), +) + +COERCIBLE_TYPE_PAIRS = { + False: ( # client instantiation of a model with client data + # (dict, ModelComposed), + # (list, ModelComposed), + # (dict, ModelNormal), + # (list, ModelNormal), + # (str, ModelSimple), + # (int, ModelSimple), + # (float, ModelSimple), + # (list, ModelSimple), + # (str, int), + # (str, float), + # (str, datetime), + # (str, date), + # (int, str), + # (float, str), + ), + True: ( # server -> client data + (dict, ModelComposed), + (list, ModelComposed), + (dict, ModelNormal), + (list, ModelNormal), + (str, ModelSimple), + (int, ModelSimple), + (float, ModelSimple), + (list, ModelSimple), + # (str, int), + # (str, float), + (str, datetime), + (str, date), + # (int, str), + # (float, str), + (str, file_type) + ), +} + + +def get_simple_class(input_value): + """Returns an input_value's simple class that we will use for type checking + Python2: + float and int will return int, where int is the python3 int backport + str and unicode will return str, where str is the python3 str backport + Note: float and int ARE both instances of int backport + Note: str_py2 and unicode_py2 are NOT both instances of str backport + + Args: + input_value (class/class_instance): the item for which we will return + the simple class + """ + if isinstance(input_value, type): + # input_value is a class + return input_value + elif isinstance(input_value, tuple): + return tuple + elif isinstance(input_value, list): + return list + elif isinstance(input_value, dict): + return dict + elif isinstance(input_value, none_type): + return none_type + elif isinstance(input_value, file_type): + return file_type + elif isinstance(input_value, bool): + # this must be higher than the int check because + # isinstance(True, int) == True + return bool + elif isinstance(input_value, int): + return int + elif isinstance(input_value, datetime): + # this must be higher than the date check because + # isinstance(datetime_instance, date) == True + return datetime + elif isinstance(input_value, date): + return date + elif isinstance(input_value, str): + return str + return type(input_value) + + +def check_allowed_values(allowed_values, input_variable_path, input_values): + """Raises an exception if the input_values are not allowed + + Args: + allowed_values (dict): the allowed_values dict + input_variable_path (tuple): the path to the input variable + input_values (list/str/int/float/date/datetime): the values that we + are checking to see if they are in allowed_values + """ + these_allowed_values = list(allowed_values[input_variable_path].values()) + if (isinstance(input_values, list) + and not set(input_values).issubset( + set(these_allowed_values))): + invalid_values = ", ".join( + map(str, set(input_values) - set(these_allowed_values))), + raise ApiValueError( + "Invalid values for `%s` [%s], must be a subset of [%s]" % + ( + input_variable_path[0], + invalid_values, + ", ".join(map(str, these_allowed_values)) + ) + ) + elif (isinstance(input_values, dict) + and not set( + input_values.keys()).issubset(set(these_allowed_values))): + invalid_values = ", ".join( + map(str, set(input_values.keys()) - set(these_allowed_values))) + raise ApiValueError( + "Invalid keys in `%s` [%s], must be a subset of [%s]" % + ( + input_variable_path[0], + invalid_values, + ", ".join(map(str, these_allowed_values)) + ) + ) + elif (not isinstance(input_values, (list, dict)) + and input_values not in these_allowed_values): + raise ApiValueError( + "Invalid value for `%s` (%s), must be one of %s" % + ( + input_variable_path[0], + input_values, + these_allowed_values + ) + ) + + +def is_json_validation_enabled(schema_keyword, configuration=None): + """Returns true if JSON schema validation is enabled for the specified + validation keyword. This can be used to skip JSON schema structural validation + as requested in the configuration. + + Args: + schema_keyword (string): the name of a JSON schema validation keyword. + configuration (Configuration): the configuration class. + """ + + return (configuration is None or + not hasattr(configuration, '_disabled_client_side_validations') or + schema_keyword not in configuration._disabled_client_side_validations) + + +def check_validations( + validations, input_variable_path, input_values, + configuration=None): + """Raises an exception if the input_values are invalid + + Args: + validations (dict): the validation dictionary. + input_variable_path (tuple): the path to the input variable. + input_values (list/str/int/float/date/datetime): the values that we + are checking. + configuration (Configuration): the configuration class. + """ + + if input_values is None: + return + + current_validations = validations[input_variable_path] + if (is_json_validation_enabled('multipleOf', configuration) and + 'multiple_of' in current_validations and + isinstance(input_values, (int, float)) and + not (float(input_values) / current_validations['multiple_of']).is_integer()): + # Note 'multipleOf' will be as good as the floating point arithmetic. + raise ApiValueError( + "Invalid value for `%s`, value must be a multiple of " + "`%s`" % ( + input_variable_path[0], + current_validations['multiple_of'] + ) + ) + + if (is_json_validation_enabled('maxLength', configuration) and + 'max_length' in current_validations and + len(input_values) > current_validations['max_length']): + raise ApiValueError( + "Invalid value for `%s`, length must be less than or equal to " + "`%s`" % ( + input_variable_path[0], + current_validations['max_length'] + ) + ) + + if (is_json_validation_enabled('minLength', configuration) and + 'min_length' in current_validations and + len(input_values) < current_validations['min_length']): + raise ApiValueError( + "Invalid value for `%s`, length must be greater than or equal to " + "`%s`" % ( + input_variable_path[0], + current_validations['min_length'] + ) + ) + + if (is_json_validation_enabled('maxItems', configuration) and + 'max_items' in current_validations and + len(input_values) > current_validations['max_items']): + raise ApiValueError( + "Invalid value for `%s`, number of items must be less than or " + "equal to `%s`" % ( + input_variable_path[0], + current_validations['max_items'] + ) + ) + + if (is_json_validation_enabled('minItems', configuration) and + 'min_items' in current_validations and + len(input_values) < current_validations['min_items']): + raise ValueError( + "Invalid value for `%s`, number of items must be greater than or " + "equal to `%s`" % ( + input_variable_path[0], + current_validations['min_items'] + ) + ) + + items = ('exclusive_maximum', 'inclusive_maximum', 'exclusive_minimum', + 'inclusive_minimum') + if (any(item in current_validations for item in items)): + if isinstance(input_values, list): + max_val = max(input_values) + min_val = min(input_values) + elif isinstance(input_values, dict): + max_val = max(input_values.values()) + min_val = min(input_values.values()) + else: + max_val = input_values + min_val = input_values + + if (is_json_validation_enabled('exclusiveMaximum', configuration) and + 'exclusive_maximum' in current_validations and + max_val >= current_validations['exclusive_maximum']): + raise ApiValueError( + "Invalid value for `%s`, must be a value less than `%s`" % ( + input_variable_path[0], + current_validations['exclusive_maximum'] + ) + ) + + if (is_json_validation_enabled('maximum', configuration) and + 'inclusive_maximum' in current_validations and + max_val > current_validations['inclusive_maximum']): + raise ApiValueError( + "Invalid value for `%s`, must be a value less than or equal to " + "`%s`" % ( + input_variable_path[0], + current_validations['inclusive_maximum'] + ) + ) + + if (is_json_validation_enabled('exclusiveMinimum', configuration) and + 'exclusive_minimum' in current_validations and + min_val <= current_validations['exclusive_minimum']): + raise ApiValueError( + "Invalid value for `%s`, must be a value greater than `%s`" % + ( + input_variable_path[0], + current_validations['exclusive_maximum'] + ) + ) + + if (is_json_validation_enabled('minimum', configuration) and + 'inclusive_minimum' in current_validations and + min_val < current_validations['inclusive_minimum']): + raise ApiValueError( + "Invalid value for `%s`, must be a value greater than or equal " + "to `%s`" % ( + input_variable_path[0], + current_validations['inclusive_minimum'] + ) + ) + flags = current_validations.get('regex', {}).get('flags', 0) + if (is_json_validation_enabled('pattern', configuration) and + 'regex' in current_validations and + not re.search(current_validations['regex']['pattern'], + input_values, flags=flags)): + err_msg = r"Invalid value for `%s`, must match regular expression `%s`" % ( + input_variable_path[0], + current_validations['regex']['pattern'] + ) + if flags != 0: + # Don't print the regex flags if the flags are not + # specified in the OAS document. + err_msg = r"%s with flags=`%s`" % (err_msg, flags) + raise ApiValueError(err_msg) + + +def order_response_types(required_types): + """Returns the required types sorted in coercion order + + Args: + required_types (list/tuple): collection of classes or instance of + list or dict with class information inside it. + + Returns: + (list): coercion order sorted collection of classes or instance + of list or dict with class information inside it. + """ + + def index_getter(class_or_instance): + if isinstance(class_or_instance, list): + return COERCION_INDEX_BY_TYPE[list] + elif isinstance(class_or_instance, dict): + return COERCION_INDEX_BY_TYPE[dict] + elif (inspect.isclass(class_or_instance) + and issubclass(class_or_instance, ModelComposed)): + return COERCION_INDEX_BY_TYPE[ModelComposed] + elif (inspect.isclass(class_or_instance) + and issubclass(class_or_instance, ModelNormal)): + return COERCION_INDEX_BY_TYPE[ModelNormal] + elif (inspect.isclass(class_or_instance) + and issubclass(class_or_instance, ModelSimple)): + return COERCION_INDEX_BY_TYPE[ModelSimple] + elif class_or_instance in COERCION_INDEX_BY_TYPE: + return COERCION_INDEX_BY_TYPE[class_or_instance] + raise ApiValueError("Unsupported type: %s" % class_or_instance) + + sorted_types = sorted( + required_types, + key=lambda class_or_instance: index_getter(class_or_instance) + ) + return sorted_types + + +def remove_uncoercible(required_types_classes, current_item, spec_property_naming, + must_convert=True): + """Only keeps the type conversions that are possible + + Args: + required_types_classes (tuple): tuple of classes that are required + these should be ordered by COERCION_INDEX_BY_TYPE + spec_property_naming (bool): True if the variable names in the input + data are serialized names as specified in the OpenAPI document. + False if the variables names in the input data are python + variable names in PEP-8 snake case. + current_item (any): the current item (input data) to be converted + + Keyword Args: + must_convert (bool): if True the item to convert is of the wrong + type and we want a big list of coercibles + if False, we want a limited list of coercibles + + Returns: + (list): the remaining coercible required types, classes only + """ + current_type_simple = get_simple_class(current_item) + + results_classes = [] + for required_type_class in required_types_classes: + # convert our models to OpenApiModel + required_type_class_simplified = required_type_class + if isinstance(required_type_class_simplified, type): + if issubclass(required_type_class_simplified, ModelComposed): + required_type_class_simplified = ModelComposed + elif issubclass(required_type_class_simplified, ModelNormal): + required_type_class_simplified = ModelNormal + elif issubclass(required_type_class_simplified, ModelSimple): + required_type_class_simplified = ModelSimple + + if required_type_class_simplified == current_type_simple: + # don't consider converting to one's own class + continue + + class_pair = (current_type_simple, required_type_class_simplified) + if must_convert and class_pair in COERCIBLE_TYPE_PAIRS[spec_property_naming]: + results_classes.append(required_type_class) + elif class_pair in UPCONVERSION_TYPE_PAIRS: + results_classes.append(required_type_class) + return results_classes + +def get_discriminated_classes(cls): + """ + Returns all the classes that a discriminator converts to + TODO: lru_cache this + """ + possible_classes = [] + key = list(cls.discriminator.keys())[0] + if is_type_nullable(cls): + possible_classes.append(cls) + for discr_cls in cls.discriminator[key].values(): + if hasattr(discr_cls, 'discriminator') and discr_cls.discriminator is not None: + possible_classes.extend(get_discriminated_classes(discr_cls)) + else: + possible_classes.append(discr_cls) + return possible_classes + + +def get_possible_classes(cls, from_server_context): + # TODO: lru_cache this + possible_classes = [cls] + if from_server_context: + return possible_classes + if hasattr(cls, 'discriminator') and cls.discriminator is not None: + possible_classes = [] + possible_classes.extend(get_discriminated_classes(cls)) + elif issubclass(cls, ModelComposed): + possible_classes.extend(composed_model_input_classes(cls)) + return possible_classes + + +def get_required_type_classes(required_types_mixed, spec_property_naming): + """Converts the tuple required_types into a tuple and a dict described + below + + Args: + required_types_mixed (tuple/list): will contain either classes or + instance of list or dict + spec_property_naming (bool): if True these values came from the + server, and we use the data types in our endpoints. + If False, we are client side and we need to include + oneOf and discriminator classes inside the data types in our endpoints + + Returns: + (valid_classes, dict_valid_class_to_child_types_mixed): + valid_classes (tuple): the valid classes that the current item + should be + dict_valid_class_to_child_types_mixed (dict): + valid_class (class): this is the key + child_types_mixed (list/dict/tuple): describes the valid child + types + """ + valid_classes = [] + child_req_types_by_current_type = {} + for required_type in required_types_mixed: + if isinstance(required_type, list): + valid_classes.append(list) + child_req_types_by_current_type[list] = required_type + elif isinstance(required_type, tuple): + valid_classes.append(tuple) + child_req_types_by_current_type[tuple] = required_type + elif isinstance(required_type, dict): + valid_classes.append(dict) + child_req_types_by_current_type[dict] = required_type[str] + else: + valid_classes.extend(get_possible_classes(required_type, spec_property_naming)) + return tuple(valid_classes), child_req_types_by_current_type + + +def change_keys_js_to_python(input_dict, model_class): + """ + Converts from javascript_key keys in the input_dict to python_keys in + the output dict using the mapping in model_class. + If the input_dict contains a key which does not declared in the model_class, + the key is added to the output dict as is. The assumption is the model_class + may have undeclared properties (additionalProperties attribute in the OAS + document). + """ + + if getattr(model_class, 'attribute_map', None) is None: + return input_dict + output_dict = {} + reversed_attr_map = {value: key for key, value in + model_class.attribute_map.items()} + for javascript_key, value in input_dict.items(): + python_key = reversed_attr_map.get(javascript_key) + if python_key is None: + # if the key is unknown, it is in error or it is an + # additionalProperties variable + python_key = javascript_key + output_dict[python_key] = value + return output_dict + + +def get_type_error(var_value, path_to_item, valid_classes, key_type=False): + error_msg = type_error_message( + var_name=path_to_item[-1], + var_value=var_value, + valid_classes=valid_classes, + key_type=key_type + ) + return ApiTypeError( + error_msg, + path_to_item=path_to_item, + valid_classes=valid_classes, + key_type=key_type + ) + + +def deserialize_primitive(data, klass, path_to_item): + """Deserializes string to primitive type. + + :param data: str/int/float + :param klass: str/class the class to convert to + + :return: int, float, str, bool, date, datetime + """ + additional_message = "" + try: + if klass in {datetime, date}: + additional_message = ( + "If you need your parameter to have a fallback " + "string value, please set its type as `type: {}` in your " + "spec. That allows the value to be any type. " + ) + if klass == datetime: + if len(data) < 8: + raise ValueError("This is not a datetime") + # The string should be in iso8601 datetime format. + parsed_datetime = parse(data) + date_only = ( + parsed_datetime.hour == 0 and + parsed_datetime.minute == 0 and + parsed_datetime.second == 0 and + parsed_datetime.tzinfo is None and + 8 <= len(data) <= 10 + ) + if date_only: + raise ValueError("This is a date, not a datetime") + return parsed_datetime + elif klass == date: + if len(data) < 8: + raise ValueError("This is not a date") + return parse(data).date() + else: + converted_value = klass(data) + if isinstance(data, str) and klass == float: + if str(converted_value) != data: + # '7' -> 7.0 -> '7.0' != '7' + raise ValueError('This is not a float') + return converted_value + except (OverflowError, ValueError) as ex: + # parse can raise OverflowError + raise ApiValueError( + "{0}Failed to parse {1} as {2}".format( + additional_message, repr(data), klass.__name__ + ), + path_to_item=path_to_item + ) from ex + + +def get_discriminator_class(model_class, + discr_name, + discr_value, cls_visited): + """Returns the child class specified by the discriminator. + + Args: + model_class (OpenApiModel): the model class. + discr_name (string): the name of the discriminator property. + discr_value (any): the discriminator value. + cls_visited (list): list of model classes that have been visited. + Used to determine the discriminator class without + visiting circular references indefinitely. + + Returns: + used_model_class (class/None): the chosen child class that will be used + to deserialize the data, for example dog.Dog. + If a class is not found, None is returned. + """ + + if model_class in cls_visited: + # The class has already been visited and no suitable class was found. + return None + cls_visited.append(model_class) + used_model_class = None + if discr_name in model_class.discriminator: + class_name_to_discr_class = model_class.discriminator[discr_name] + used_model_class = class_name_to_discr_class.get(discr_value) + if used_model_class is None: + # We didn't find a discriminated class in class_name_to_discr_class. + # So look in the ancestor or descendant discriminators + # The discriminator mapping may exist in a descendant (anyOf, oneOf) + # or ancestor (allOf). + # Ancestor example: in the GrandparentAnimal -> ParentPet -> ChildCat + # hierarchy, the discriminator mappings may be defined at any level + # in the hierarchy. + # Descendant example: mammal -> whale/zebra/Pig -> BasquePig/DanishPig + # if we try to make BasquePig from mammal, we need to travel through + # the oneOf descendant discriminators to find BasquePig + descendant_classes = model_class._composed_schemas.get('oneOf', ()) + \ + model_class._composed_schemas.get('anyOf', ()) + ancestor_classes = model_class._composed_schemas.get('allOf', ()) + possible_classes = descendant_classes + ancestor_classes + for cls in possible_classes: + # Check if the schema has inherited discriminators. + if hasattr(cls, 'discriminator') and cls.discriminator is not None: + used_model_class = get_discriminator_class( + cls, discr_name, discr_value, cls_visited) + if used_model_class is not None: + return used_model_class + return used_model_class + + +def deserialize_model(model_data, model_class, path_to_item, check_type, + configuration, spec_property_naming): + """Deserializes model_data to model instance. + + Args: + model_data (int/str/float/bool/none_type/list/dict): data to instantiate the model + model_class (OpenApiModel): the model class + path_to_item (list): path to the model in the received data + check_type (bool): whether to check the data tupe for the values in + the model + configuration (Configuration): the instance to use to convert files + spec_property_naming (bool): True if the variable names in the input + data are serialized names as specified in the OpenAPI document. + False if the variables names in the input data are python + variable names in PEP-8 snake case. + + Returns: + model instance + + Raise: + ApiTypeError + ApiValueError + ApiKeyError + """ + + kw_args = dict(_check_type=check_type, + _path_to_item=path_to_item, + _configuration=configuration, + _spec_property_naming=spec_property_naming) + + if issubclass(model_class, ModelSimple): + return model_class(model_data, **kw_args) + elif isinstance(model_data, list): + return model_class(*model_data, **kw_args) + if isinstance(model_data, dict): + kw_args.update(model_data) + return model_class(**kw_args) + elif isinstance(model_data, PRIMITIVE_TYPES): + return model_class(model_data, **kw_args) + + +def deserialize_file(response_data, configuration, content_disposition=None): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + Args: + param response_data (str): the file data to write + configuration (Configuration): the instance to use to convert files + + Keyword Args: + content_disposition (str): the value of the Content-Disposition + header + + Returns: + (file_type): the deserialized file which is open + The user is responsible for closing and reading the file + """ + fd, path = tempfile.mkstemp(dir=configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + if isinstance(response_data, str): + # change str to bytes so we can write it + response_data = response_data.encode('utf-8') + f.write(response_data) + + f = open(path, "rb") + return f + + +def attempt_convert_item(input_value, valid_classes, path_to_item, + configuration, spec_property_naming, key_type=False, + must_convert=False, check_type=True): + """ + Args: + input_value (any): the data to convert + valid_classes (any): the classes that are valid + path_to_item (list): the path to the item to convert + configuration (Configuration): the instance to use to convert files + spec_property_naming (bool): True if the variable names in the input + data are serialized names as specified in the OpenAPI document. + False if the variables names in the input data are python + variable names in PEP-8 snake case. + key_type (bool): if True we need to convert a key type (not supported) + must_convert (bool): if True we must convert + check_type (bool): if True we check the type or the returned data in + ModelComposed/ModelNormal/ModelSimple instances + + Returns: + instance (any) the fixed item + + Raises: + ApiTypeError + ApiValueError + ApiKeyError + """ + valid_classes_ordered = order_response_types(valid_classes) + valid_classes_coercible = remove_uncoercible( + valid_classes_ordered, input_value, spec_property_naming) + if not valid_classes_coercible or key_type: + # we do not handle keytype errors, json will take care + # of this for us + if configuration is None or not configuration.discard_unknown_keys: + raise get_type_error(input_value, path_to_item, valid_classes, + key_type=key_type) + for valid_class in valid_classes_coercible: + try: + if issubclass(valid_class, OpenApiModel): + return deserialize_model(input_value, valid_class, + path_to_item, check_type, + configuration, spec_property_naming) + elif valid_class == file_type: + return deserialize_file(input_value, configuration) + return deserialize_primitive(input_value, valid_class, + path_to_item) + except (ApiTypeError, ApiValueError, ApiKeyError) as conversion_exc: + if must_convert: + raise conversion_exc + # if we have conversion errors when must_convert == False + # we ignore the exception and move on to the next class + continue + # we were unable to convert, must_convert == False + return input_value + + +def is_type_nullable(input_type): + """ + Returns true if None is an allowed value for the specified input_type. + + A type is nullable if at least one of the following conditions is true: + 1. The OAS 'nullable' attribute has been specified, + 1. The type is the 'null' type, + 1. The type is a anyOf/oneOf composed schema, and a child schema is + the 'null' type. + Args: + input_type (type): the class of the input_value that we are + checking + Returns: + bool + """ + if input_type is none_type: + return True + if issubclass(input_type, OpenApiModel) and input_type._nullable: + return True + if issubclass(input_type, ModelComposed): + # If oneOf/anyOf, check if the 'null' type is one of the allowed types. + for t in input_type._composed_schemas.get('oneOf', ()): + if is_type_nullable(t): return True + for t in input_type._composed_schemas.get('anyOf', ()): + if is_type_nullable(t): return True + return False + + +def is_valid_type(input_class_simple, valid_classes): + """ + Args: + input_class_simple (class): the class of the input_value that we are + checking + valid_classes (tuple): the valid classes that the current item + should be + Returns: + bool + """ + valid_type = input_class_simple in valid_classes + if not valid_type and ( + issubclass(input_class_simple, OpenApiModel) or + input_class_simple is none_type): + for valid_class in valid_classes: + if valid_class is object: + # this is to handle oneOf fields in a Model. AAPI team added this if condition to handle Quant API + return True + if input_class_simple is none_type and is_type_nullable(valid_class): + # Schema is oneOf/anyOf and the 'null' type is one of the allowed types. + return True + if not (issubclass(valid_class, OpenApiModel) and valid_class.discriminator): + continue + discr_propertyname_py = list(valid_class.discriminator.keys())[0] + discriminator_classes = ( + valid_class.discriminator[discr_propertyname_py].values() + ) + valid_type = is_valid_type(input_class_simple, discriminator_classes) + if valid_type: + return True + return valid_type + + +def validate_and_convert_types(input_value, required_types_mixed, path_to_item, + spec_property_naming, _check_type, configuration=None): + """Raises a TypeError is there is a problem, otherwise returns value + + Args: + input_value (any): the data to validate/convert + required_types_mixed (list/dict/tuple): A list of + valid classes, or a list tuples of valid classes, or a dict where + the value is a tuple of value classes + path_to_item: (list) the path to the data being validated + this stores a list of keys or indices to get to the data being + validated + spec_property_naming (bool): True if the variable names in the input + data are serialized names as specified in the OpenAPI document. + False if the variables names in the input data are python + variable names in PEP-8 snake case. + _check_type: (boolean) if true, type will be checked and conversion + will be attempted. + configuration: (Configuration): the configuration class to use + when converting file_type items. + If passed, conversion will be attempted when possible + If not passed, no conversions will be attempted and + exceptions will be raised + + Returns: + the correctly typed value + + Raises: + ApiTypeError + """ + results = get_required_type_classes(required_types_mixed, spec_property_naming) + valid_classes, child_req_types_by_current_type = results + + input_class_simple = get_simple_class(input_value) + valid_type = is_valid_type(input_class_simple, valid_classes) + if not valid_type: + if configuration: + # if input_value is not valid_type try to convert it + converted_instance = attempt_convert_item( + input_value, + valid_classes, + path_to_item, + configuration, + spec_property_naming, + key_type=False, + must_convert=True, + check_type=_check_type + ) + return converted_instance + else: + raise get_type_error(input_value, path_to_item, valid_classes, + key_type=False) + + # input_value's type is in valid_classes + if len(valid_classes) > 1 and configuration: + # there are valid classes which are not the current class + valid_classes_coercible = remove_uncoercible( + valid_classes, input_value, spec_property_naming, must_convert=False) + if valid_classes_coercible: + converted_instance = attempt_convert_item( + input_value, + valid_classes_coercible, + path_to_item, + configuration, + spec_property_naming, + key_type=False, + must_convert=False, + check_type=_check_type + ) + return converted_instance + + if child_req_types_by_current_type == {}: + # all types are of the required types and there are no more inner + # variables left to look at + return input_value + inner_required_types = child_req_types_by_current_type.get( + type(input_value) + ) + if inner_required_types is None: + # for this type, there are not more inner variables left to look at + return input_value + if isinstance(input_value, list): + if input_value == []: + # allow an empty list + return input_value + for index, inner_value in enumerate(input_value): + inner_path = list(path_to_item) + inner_path.append(index) + input_value[index] = validate_and_convert_types( + inner_value, + inner_required_types, + inner_path, + spec_property_naming, + _check_type, + configuration=configuration + ) + elif isinstance(input_value, dict): + if input_value == {}: + # allow an empty dict + return input_value + for inner_key, inner_val in input_value.items(): + inner_path = list(path_to_item) + inner_path.append(inner_key) + if get_simple_class(inner_key) != str: + raise get_type_error(inner_key, inner_path, valid_classes, + key_type=True) + input_value[inner_key] = validate_and_convert_types( + inner_val, + inner_required_types, + inner_path, + spec_property_naming, + _check_type, + configuration=configuration + ) + return input_value + + +def model_to_dict(model_instance, serialize=True): + """Returns the model properties as a dict + + Args: + model_instance (one of your model instances): the model instance that + will be converted to a dict. + + Keyword Args: + serialize (bool): if True, the keys in the dict will be values from + attribute_map + """ + result = {} + + model_instances = [model_instance] + if model_instance._composed_schemas: + model_instances.extend(model_instance._composed_instances) + for model_instance in model_instances: + for attr, value in model_instance._data_store.items(): + if serialize: + # we use get here because additional property key names do not + # exist in attribute_map + attr = model_instance.attribute_map.get(attr, attr) + if isinstance(value, list): + if not value or isinstance(value[0], PRIMITIVE_TYPES): + # empty list or primitive types + result[attr] = value + elif isinstance(value[0], ModelSimple): + result[attr] = [x.value for x in value] + else: + result[attr] = [model_to_dict(x, serialize=serialize) for x in value] + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], + model_to_dict(item[1], serialize=serialize)) + if hasattr(item[1], '_data_store') else item, + value.items() + )) + elif isinstance(value, ModelSimple): + result[attr] = value.value + elif hasattr(value, '_data_store'): + result[attr] = model_to_dict(value, serialize=serialize) + else: + result[attr] = value + + return result + + +def type_error_message(var_value=None, var_name=None, valid_classes=None, + key_type=None): + """ + Keyword Args: + var_value (any): the variable which has the type_error + var_name (str): the name of the variable which has the typ error + valid_classes (tuple): the accepted classes for current_item's + value + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + """ + key_or_value = 'value' + if key_type: + key_or_value = 'key' + valid_classes_phrase = get_valid_classes_phrase(valid_classes) + msg = ( + "Invalid type for variable '{0}'. Required {1} type {2} and " + "passed type was {3}".format( + var_name, + key_or_value, + valid_classes_phrase, + type(var_value).__name__, + ) + ) + return msg + + +def get_valid_classes_phrase(input_classes): + """Returns a string phrase describing what types are allowed + """ + all_classes = list(input_classes) + all_classes = sorted(all_classes, key=lambda cls: cls.__name__) + all_class_names = [cls.__name__ for cls in all_classes] + if len(all_class_names) == 1: + return 'is {0}'.format(all_class_names[0]) + return "is one of [{0}]".format(", ".join(all_class_names)) + + +def convert_js_args_to_python_args(fn): + from functools import wraps + @wraps(fn) + def wrapped_init(self, *args, **kwargs): + spec_property_naming = kwargs.get('_spec_property_naming', False) + if spec_property_naming: + kwargs = change_keys_js_to_python(kwargs, self.__class__) + return fn(self, *args, **kwargs) + return wrapped_init + + +def get_allof_instances(self, model_args, constant_args): + """ + Args: + self: the class we are handling + model_args (dict): var_name to var_value + used to make instances + constant_args (dict): var_name to var_value + used to make instances + + Returns + composed_instances (list) + """ + composed_instances = [] + for allof_class in self._composed_schemas['allOf']: + + # no need to handle changing js keys to python because + # for composed schemas, allof parameters are included in the + # composed schema and were changed to python keys in __new__ + # extract a dict of only required keys from fixed_model_args + kwargs = {} + var_names = set(allof_class.openapi_types.keys()) + for var_name in var_names: + if var_name in model_args: + kwargs[var_name] = model_args[var_name] + + # and use it to make the instance + kwargs.update(constant_args) + try: + allof_instance = allof_class(**kwargs) + composed_instances.append(allof_instance) + except Exception as ex: + raise ApiValueError( + "Invalid inputs given to generate an instance of '%s'. The " + "input data was invalid for the allOf schema '%s' in the composed " + "schema '%s'. Error=%s" % ( + allof_class.__name__, + allof_class.__name__, + self.__class__.__name__, + str(ex) + ) + ) from ex + return composed_instances + + +def get_oneof_instance(cls, model_kwargs, constant_kwargs, model_arg=None): + """ + Find the oneOf schema that matches the input data (e.g. payload). + If exactly one schema matches the input data, an instance of that schema + is returned. + If zero or more than one schema match the input data, an exception is raised. + In OAS 3.x, the payload MUST, by validation, match exactly one of the + schemas described by oneOf. + + Args: + cls: the class we are handling + model_kwargs (dict): var_name to var_value + The input data, e.g. the payload that must match a oneOf schema + in the OpenAPI document. + constant_kwargs (dict): var_name to var_value + args that every model requires, including configuration, server + and path to item. + + Kwargs: + model_arg: (int, float, bool, str, date, datetime, ModelSimple, None): + the value to assign to a primitive class or ModelSimple class + Notes: + - this is only passed in when oneOf includes types which are not object + - None is used to suppress handling of model_arg, nullable models are handled in __new__ + + Returns + oneof_instance (instance) + """ + if len(cls._composed_schemas['oneOf']) == 0: + return None + + oneof_instances = [] + # Iterate over each oneOf schema and determine if the input data + # matches the oneOf schemas. + for oneof_class in cls._composed_schemas['oneOf']: + # The composed oneOf schema allows the 'null' type and the input data + # is the null value. This is a OAS >= 3.1 feature. + if oneof_class is none_type: + # skip none_types because we are deserializing dict data. + # none_type deserialization is handled in the __new__ method + continue + + single_value_input = allows_single_value_input(oneof_class) + + if not single_value_input: + # transform js keys from input data to python keys in fixed_model_args + fixed_model_args = change_keys_js_to_python( + model_kwargs, oneof_class) + + # Extract a dict with the properties that are declared in the oneOf schema. + # Undeclared properties (e.g. properties that are allowed because of the + # additionalProperties attribute in the OAS document) are not added to + # the dict. + kwargs = {} + var_names = set(oneof_class.openapi_types.keys()) + for var_name in var_names: + if var_name in fixed_model_args: + kwargs[var_name] = fixed_model_args[var_name] + + # do not try to make a model with no input args + if len(kwargs) == 0: + continue + + # and use it to make the instance + kwargs.update(constant_kwargs) + + try: + if not single_value_input: + oneof_instance = oneof_class(**kwargs) + else: + if issubclass(oneof_class, ModelSimple): + oneof_instance = oneof_class(model_arg, **constant_kwargs) + elif oneof_class in PRIMITIVE_TYPES: + oneof_instance = validate_and_convert_types( + model_arg, + (oneof_class,), + constant_kwargs['_path_to_item'], + constant_kwargs['_spec_property_naming'], + constant_kwargs['_check_type'], + configuration=constant_kwargs['_configuration'] + ) + oneof_instances.append(oneof_instance) + except Exception: + pass + if len(oneof_instances) == 0: + raise ApiValueError( + "Invalid inputs given to generate an instance of %s. None " + "of the oneOf schemas matched the input data." % + cls.__name__ + ) + elif len(oneof_instances) > 1: + raise ApiValueError( + "Invalid inputs given to generate an instance of %s. Multiple " + "oneOf schemas matched the inputs, but a max of one is allowed." % + cls.__name__ + ) + return oneof_instances[0] + + +def get_anyof_instances(self, model_args, constant_args): + """ + Args: + self: the class we are handling + model_args (dict): var_name to var_value + The input data, e.g. the payload that must match at least one + anyOf child schema in the OpenAPI document. + constant_args (dict): var_name to var_value + args that every model requires, including configuration, server + and path to item. + + Returns + anyof_instances (list) + """ + anyof_instances = [] + if len(self._composed_schemas['anyOf']) == 0: + return anyof_instances + + for anyof_class in self._composed_schemas['anyOf']: + # The composed oneOf schema allows the 'null' type and the input data + # is the null value. This is a OAS >= 3.1 feature. + if anyof_class is none_type: + # skip none_types because we are deserializing dict data. + # none_type deserialization is handled in the __new__ method + continue + + # transform js keys to python keys in fixed_model_args + fixed_model_args = change_keys_js_to_python(model_args, anyof_class) + + # extract a dict of only required keys from these_model_vars + kwargs = {} + var_names = set(anyof_class.openapi_types.keys()) + for var_name in var_names: + if var_name in fixed_model_args: + kwargs[var_name] = fixed_model_args[var_name] + + # do not try to make a model with no input args + if len(kwargs) == 0: + continue + + # and use it to make the instance + kwargs.update(constant_args) + try: + anyof_instance = anyof_class(**kwargs) + anyof_instances.append(anyof_instance) + except Exception: + pass + if len(anyof_instances) == 0: + raise ApiValueError( + "Invalid inputs given to generate an instance of %s. None of the " + "anyOf schemas matched the inputs." % + self.__class__.__name__ + ) + return anyof_instances + + +def get_additional_properties_model_instances( + composed_instances, self): + additional_properties_model_instances = [] + all_instances = [self] + all_instances.extend(composed_instances) + for instance in all_instances: + if instance.additional_properties_type is not None: + additional_properties_model_instances.append(instance) + return additional_properties_model_instances + + +def get_var_name_to_model_instances(self, composed_instances): + var_name_to_model_instances = {} + all_instances = [self] + all_instances.extend(composed_instances) + for instance in all_instances: + for var_name in instance.openapi_types: + if var_name not in var_name_to_model_instances: + var_name_to_model_instances[var_name] = [instance] + else: + var_name_to_model_instances[var_name].append(instance) + return var_name_to_model_instances + + +def get_unused_args(self, composed_instances, model_args): + unused_args = dict(model_args) + # arguments apssed to self were already converted to python names + # before __init__ was called + for var_name_py in self.attribute_map: + if var_name_py in unused_args: + del unused_args[var_name_py] + for instance in composed_instances: + if instance.__class__ in self._composed_schemas['allOf']: + for var_name_py in instance.attribute_map: + if var_name_py in unused_args: + del unused_args[var_name_py] + else: + for var_name_js in instance.attribute_map.values(): + if var_name_js in unused_args: + del unused_args[var_name_js] + return unused_args + + +def validate_get_composed_info(constant_args, model_args, self): + """ + For composed schemas, generate schema instances for + all schemas in the oneOf/anyOf/allOf definition. If additional + properties are allowed, also assign those properties on + all matched schemas that contain additionalProperties. + Openapi schemas are python classes. + + Exceptions are raised if: + - 0 or > 1 oneOf schema matches the model_args input data + - no anyOf schema matches the model_args input data + - any of the allOf schemas do not match the model_args input data + + Args: + constant_args (dict): these are the args that every model requires + model_args (dict): these are the required and optional spec args that + were passed in to make this model + self (class): the class that we are instantiating + This class contains self._composed_schemas + + Returns: + composed_info (list): length three + composed_instances (list): the composed instances which are not + self + var_name_to_model_instances (dict): a dict going from var_name + to the model_instance which holds that var_name + the model_instance may be self or an instance of one of the + classes in self.composed_instances() + additional_properties_model_instances (list): a list of the + model instances which have the property + additional_properties_type. This list can include self + """ + # create composed_instances + composed_instances = [] + allof_instances = get_allof_instances(self, model_args, constant_args) + composed_instances.extend(allof_instances) + oneof_instance = get_oneof_instance(self.__class__, model_args, constant_args) + if oneof_instance is not None: + composed_instances.append(oneof_instance) + anyof_instances = get_anyof_instances(self, model_args, constant_args) + composed_instances.extend(anyof_instances) + + # map variable names to composed_instances + var_name_to_model_instances = get_var_name_to_model_instances( + self, composed_instances) + + # set additional_properties_model_instances + additional_properties_model_instances = ( + get_additional_properties_model_instances(composed_instances, self) + ) + + # set any remaining values + unused_args = get_unused_args(self, composed_instances, model_args) + if len(unused_args) > 0 and \ + len(additional_properties_model_instances) == 0 and \ + (self._configuration is None or + not self._configuration.discard_unknown_keys): + raise ApiValueError( + "Invalid input arguments input when making an instance of " + "class %s. Not all inputs were used. The unused input data " + "is %s" % (self.__class__.__name__, unused_args) + ) + + # no need to add additional_properties to var_name_to_model_instances here + # because additional_properties_model_instances will direct us to that + # instance when we use getattr or setattr + # and we update var_name_to_model_instances in setattr + + return [ + composed_instances, + var_name_to_model_instances, + additional_properties_model_instances, + unused_args + ] \ No newline at end of file From cb0ba5a25ba7845c26e07749d6779767a1f8195f Mon Sep 17 00:00:00 2001 From: Sai Giridhar P Date: Thu, 25 Nov 2021 11:19:57 +0530 Subject: [PATCH 04/12] fix(version): Incrementing package version --- languages/python/openapi-generator-config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/languages/python/openapi-generator-config.json b/languages/python/openapi-generator-config.json index 6416ee0..05c9732 100644 --- a/languages/python/openapi-generator-config.json +++ b/languages/python/openapi-generator-config.json @@ -1,7 +1,7 @@ { "packageName": "fds.analyticsapi.engines", "projectName": "fds.analyticsapi.engines", - "packageVersion": "5.2.0", + "packageVersion": "5.3.0", "packageUrl": "https://github.com/factset/analyticsapi-engines-python-sdk", - "httpUserAgent": "engines-api/5.2.0/python" + "httpUserAgent": "engines-api/5.3.0/python" } From 2d935949bc03b6783bddbd54beeaf4bbd0261e05 Mon Sep 17 00:00:00 2001 From: Sai Giridhar P Date: Mon, 27 Dec 2021 18:50:58 +0530 Subject: [PATCH 05/12] fix(dotnet): Incrementing open api generator version --- .github/workflows/pull-request.yml | 2 +- openapi-generator/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 34fbd28..ee31c99 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -4,7 +4,7 @@ env: USER_API_KEY: ${{ secrets.USER_API_KEY }} USER_EMAIL: ${{ secrets.USER_EMAIL }} USER: ${{ secrets.USER }} - OPENAPI_GENERATOR_VERSION: 5.1.0 + OPENAPI_GENERATOR_VERSION: 5.3.1 GITHUB_DOTNET_SDK_REPO: factset/analyticsapi-engines-dotnet-sdk GITHUB_PYTHON_SDK_REPO: factset/analyticsapi-engines-python-sdk GITHUB_JAVA_SDK_REPO: factset/analyticsapi-engines-java-sdk diff --git a/openapi-generator/Dockerfile b/openapi-generator/Dockerfile index 4575c02..86b392d 100644 --- a/openapi-generator/Dockerfile +++ b/openapi-generator/Dockerfile @@ -1,6 +1,6 @@ FROM openjdk:8 -ARG VERSION=5.1.0 +ARG VERSION=5.3.1 ENV GEN_DIR /opt/openapi-generator From b211ba7cdee20c77dd60f4501be4807f18c53ae6 Mon Sep 17 00:00:00 2001 From: Sai Giridhar P Date: Mon, 27 Dec 2021 19:02:47 +0530 Subject: [PATCH 06/12] fix(dotnet): Removing model utils mustache --- .../python/templates/model_utils.mustache | 1609 ----------------- 1 file changed, 1609 deletions(-) delete mode 100644 languages/python/templates/model_utils.mustache diff --git a/languages/python/templates/model_utils.mustache b/languages/python/templates/model_utils.mustache deleted file mode 100644 index 758cb0b..0000000 --- a/languages/python/templates/model_utils.mustache +++ /dev/null @@ -1,1609 +0,0 @@ -{{! This file is picked from the v5.1.0 release of openapi-generator(https://github.com/OpenAPITools/openapi-generator/blob/v5.1.0/modules/openapi-generator/src/main/resources/python/model_utils.mustache) }} -{{! Changes made: 1) Made a change to support oneof in the Models at line 1062 }} - -{{>partial_header}} - -from datetime import date, datetime # noqa: F401 -import inspect -import io -import os -import pprint -import re -import tempfile - -from dateutil.parser import parse - -from {{packageName}}.exceptions import ( - ApiKeyError, - ApiAttributeError, - ApiTypeError, - ApiValueError, -) - -none_type = type(None) -file_type = io.IOBase - - -class cached_property(object): - # this caches the result of the function call for fn with no inputs - # use this as a decorator on fuction methods that you want converted - # into cached properties - result_key = '_results' - - def __init__(self, fn): - self._fn = fn - - def __get__(self, instance, cls=None): - if self.result_key in vars(self): - return vars(self)[self.result_key] - else: - result = self._fn() - setattr(self, self.result_key, result) - return result - - -PRIMITIVE_TYPES = (list, float, int, bool, datetime, date, str, file_type) - -def allows_single_value_input(cls): - """ - This function returns True if the input composed schema model or any - descendant model allows a value only input - This is true for cases where oneOf contains items like: - oneOf: - - float - - NumberWithValidation - - StringEnum - - ArrayModel - - null - TODO: lru_cache this - """ - if ( - issubclass(cls, ModelSimple) or - cls in PRIMITIVE_TYPES - ): - return True - elif issubclass(cls, ModelComposed): - if not cls._composed_schemas['oneOf']: - return False - return any(allows_single_value_input(c) for c in cls._composed_schemas['oneOf']) - return False - -def composed_model_input_classes(cls): - """ - This function returns a list of the possible models that can be accepted as - inputs. - TODO: lru_cache this - """ - if issubclass(cls, ModelSimple) or cls in PRIMITIVE_TYPES: - return [cls] - elif issubclass(cls, ModelNormal): - if cls.discriminator is None: - return [cls] - else: - return get_discriminated_classes(cls) - elif issubclass(cls, ModelComposed): - if not cls._composed_schemas['oneOf']: - return [] - if cls.discriminator is None: - input_classes = [] - for c in cls._composed_schemas['oneOf']: - input_classes.extend(composed_model_input_classes(c)) - return input_classes - else: - return get_discriminated_classes(cls) - return [] - - -class OpenApiModel(object): - """The base class for all OpenAPIModels""" - -{{> model_templates/method_set_attribute }} - -{{> model_templates/methods_shared }} - - def __new__(cls, *args, **kwargs): - # this function uses the discriminator to - # pick a new schema/class to instantiate because a discriminator - # propertyName value was passed in - - if len(args) == 1: - arg = args[0] - if arg is None and is_type_nullable(cls): - # The input data is the 'null' value and the type is nullable. - return None - - if issubclass(cls, ModelComposed) and allows_single_value_input(cls): - model_kwargs = {} - oneof_instance = get_oneof_instance(cls, model_kwargs, kwargs, model_arg=arg) - return oneof_instance - - - visited_composed_classes = kwargs.get('_visited_composed_classes', ()) - if ( - cls.discriminator is None or - cls in visited_composed_classes - ): - # Use case 1: this openapi schema (cls) does not have a discriminator - # Use case 2: we have already visited this class before and are sure that we - # want to instantiate it this time. We have visited this class deserializing - # a payload with a discriminator. During that process we traveled through - # this class but did not make an instance of it. Now we are making an - # instance of a composed class which contains cls in it, so this time make an instance of cls. - # - # Here's an example of use case 2: If Animal has a discriminator - # petType and we pass in "Dog", and the class Dog - # allOf includes Animal, we move through Animal - # once using the discriminator, and pick Dog. - # Then in the composed schema dog Dog, we will make an instance of the - # Animal class (because Dal has allOf: Animal) but this time we won't travel - # through Animal's discriminator because we passed in - # _visited_composed_classes = (Animal,) - - return super(OpenApiModel, cls).__new__(cls) - - # Get the name and value of the discriminator property. - # The discriminator name is obtained from the discriminator meta-data - # and the discriminator value is obtained from the input data. - discr_propertyname_py = list(cls.discriminator.keys())[0] - discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if discr_propertyname_js in kwargs: - discr_value = kwargs[discr_propertyname_js] - elif discr_propertyname_py in kwargs: - discr_value = kwargs[discr_propertyname_py] - else: - # The input data does not contain the discriminator property. - path_to_item = kwargs.get('_path_to_item', ()) - raise ApiValueError( - "Cannot deserialize input data due to missing discriminator. " - "The discriminator property '%s' is missing at path: %s" % - (discr_propertyname_js, path_to_item) - ) - - # Implementation note: the last argument to get_discriminator_class - # is a list of visited classes. get_discriminator_class may recursively - # call itself and update the list of visited classes, and the initial - # value must be an empty list. Hence not using 'visited_composed_classes' - new_cls = get_discriminator_class( - cls, discr_propertyname_py, discr_value, []) - if new_cls is None: - path_to_item = kwargs.get('_path_to_item', ()) - disc_prop_value = kwargs.get( - discr_propertyname_js, kwargs.get(discr_propertyname_py)) - raise ApiValueError( - "Cannot deserialize input data due to invalid discriminator " - "value. The OpenAPI document has no mapping for discriminator " - "property '%s'='%s' at path: %s" % - (discr_propertyname_js, disc_prop_value, path_to_item) - ) - - if new_cls in visited_composed_classes: - # if we are making an instance of a composed schema Descendent - # which allOf includes Ancestor, then Ancestor contains - # a discriminator that includes Descendent. - # So if we make an instance of Descendent, we have to make an - # instance of Ancestor to hold the allOf properties. - # This code detects that use case and makes the instance of Ancestor - # For example: - # When making an instance of Dog, _visited_composed_classes = (Dog,) - # then we make an instance of Animal to include in dog._composed_instances - # so when we are here, cls is Animal - # cls.discriminator != None - # cls not in _visited_composed_classes - # new_cls = Dog - # but we know we know that we already have Dog - # because it is in visited_composed_classes - # so make Animal here - return super(OpenApiModel, cls).__new__(cls) - - # Build a list containing all oneOf and anyOf descendants. - oneof_anyof_classes = None - if cls._composed_schemas is not None: - oneof_anyof_classes = ( - cls._composed_schemas.get('oneOf', ()) + - cls._composed_schemas.get('anyOf', ())) - oneof_anyof_child = new_cls in oneof_anyof_classes - kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,) - - if cls._composed_schemas.get('allOf') and oneof_anyof_child: - # Validate that we can make self because when we make the - # new_cls it will not include the allOf validations in self - self_inst = super(OpenApiModel, cls).__new__(cls) - self_inst.__init__(*args, **kwargs) - - new_inst = new_cls.__new__(new_cls, *args, **kwargs) - new_inst.__init__(*args, **kwargs) - return new_inst - - -class ModelSimple(OpenApiModel): - """the parent class of models whose type != object in their - swagger/openapi""" - -{{> model_templates/methods_setattr_getattr_normal }} - -{{> model_templates/methods_tostr_eq_simple }} - - -class ModelNormal(OpenApiModel): - """the parent class of models whose type == object in their - swagger/openapi""" - -{{> model_templates/methods_setattr_getattr_normal }} - -{{> model_templates/methods_todict_tostr_eq_shared}} - - -class ModelComposed(OpenApiModel): - """the parent class of models whose type == object in their - swagger/openapi and have oneOf/allOf/anyOf - - When one sets a property we use var_name_to_model_instances to store the value in - the correct class instances + run any type checking + validation code. - When one gets a property we use var_name_to_model_instances to get the value - from the correct class instances. - This allows multiple composed schemas to contain the same property with additive - constraints on the value. - - _composed_schemas (dict) stores the anyOf/allOf/oneOf classes - key (str): allOf/oneOf/anyOf - value (list): the classes in the XOf definition. - Note: none_type can be included when the openapi document version >= 3.1.0 - _composed_instances (list): stores a list of instances of the composed schemas - defined in _composed_schemas. When properties are accessed in the self instance, - they are returned from the self._data_store or the data stores in the instances - in self._composed_schemas - _var_name_to_model_instances (dict): maps between a variable name on self and - the composed instances (self included) which contain that data - key (str): property name - value (list): list of class instances, self or instances in _composed_instances - which contain the value that the key is referring to. - """ - -{{> model_templates/methods_setattr_getattr_composed }} - -{{> model_templates/methods_todict_tostr_eq_shared}} - - -COERCION_INDEX_BY_TYPE = { - ModelComposed: 0, - ModelNormal: 1, - ModelSimple: 2, - none_type: 3, # The type of 'None'. - list: 4, - dict: 5, - float: 6, - int: 7, - bool: 8, - datetime: 9, - date: 10, - str: 11, - file_type: 12, # 'file_type' is an alias for the built-in 'file' or 'io.IOBase' type. -} - -# these are used to limit what type conversions we try to do -# when we have a valid type already and we want to try converting -# to another type -UPCONVERSION_TYPE_PAIRS = ( - (str, datetime), - (str, date), - (int, float), # A float may be serialized as an integer, e.g. '3' is a valid serialized float. - (list, ModelComposed), - (dict, ModelComposed), - (str, ModelComposed), - (int, ModelComposed), - (float, ModelComposed), - (list, ModelComposed), - (list, ModelNormal), - (dict, ModelNormal), - (str, ModelSimple), - (int, ModelSimple), - (float, ModelSimple), - (list, ModelSimple), -) - -COERCIBLE_TYPE_PAIRS = { - False: ( # client instantiation of a model with client data - # (dict, ModelComposed), - # (list, ModelComposed), - # (dict, ModelNormal), - # (list, ModelNormal), - # (str, ModelSimple), - # (int, ModelSimple), - # (float, ModelSimple), - # (list, ModelSimple), - # (str, int), - # (str, float), - # (str, datetime), - # (str, date), - # (int, str), - # (float, str), - ), - True: ( # server -> client data - (dict, ModelComposed), - (list, ModelComposed), - (dict, ModelNormal), - (list, ModelNormal), - (str, ModelSimple), - (int, ModelSimple), - (float, ModelSimple), - (list, ModelSimple), - # (str, int), - # (str, float), - (str, datetime), - (str, date), - # (int, str), - # (float, str), - (str, file_type) - ), -} - - -def get_simple_class(input_value): - """Returns an input_value's simple class that we will use for type checking - Python2: - float and int will return int, where int is the python3 int backport - str and unicode will return str, where str is the python3 str backport - Note: float and int ARE both instances of int backport - Note: str_py2 and unicode_py2 are NOT both instances of str backport - - Args: - input_value (class/class_instance): the item for which we will return - the simple class - """ - if isinstance(input_value, type): - # input_value is a class - return input_value - elif isinstance(input_value, tuple): - return tuple - elif isinstance(input_value, list): - return list - elif isinstance(input_value, dict): - return dict - elif isinstance(input_value, none_type): - return none_type - elif isinstance(input_value, file_type): - return file_type - elif isinstance(input_value, bool): - # this must be higher than the int check because - # isinstance(True, int) == True - return bool - elif isinstance(input_value, int): - return int - elif isinstance(input_value, datetime): - # this must be higher than the date check because - # isinstance(datetime_instance, date) == True - return datetime - elif isinstance(input_value, date): - return date - elif isinstance(input_value, str): - return str - return type(input_value) - - -def check_allowed_values(allowed_values, input_variable_path, input_values): - """Raises an exception if the input_values are not allowed - - Args: - allowed_values (dict): the allowed_values dict - input_variable_path (tuple): the path to the input variable - input_values (list/str/int/float/date/datetime): the values that we - are checking to see if they are in allowed_values - """ - these_allowed_values = list(allowed_values[input_variable_path].values()) - if (isinstance(input_values, list) - and not set(input_values).issubset( - set(these_allowed_values))): - invalid_values = ", ".join( - map(str, set(input_values) - set(these_allowed_values))), - raise ApiValueError( - "Invalid values for `%s` [%s], must be a subset of [%s]" % - ( - input_variable_path[0], - invalid_values, - ", ".join(map(str, these_allowed_values)) - ) - ) - elif (isinstance(input_values, dict) - and not set( - input_values.keys()).issubset(set(these_allowed_values))): - invalid_values = ", ".join( - map(str, set(input_values.keys()) - set(these_allowed_values))) - raise ApiValueError( - "Invalid keys in `%s` [%s], must be a subset of [%s]" % - ( - input_variable_path[0], - invalid_values, - ", ".join(map(str, these_allowed_values)) - ) - ) - elif (not isinstance(input_values, (list, dict)) - and input_values not in these_allowed_values): - raise ApiValueError( - "Invalid value for `%s` (%s), must be one of %s" % - ( - input_variable_path[0], - input_values, - these_allowed_values - ) - ) - - -def is_json_validation_enabled(schema_keyword, configuration=None): - """Returns true if JSON schema validation is enabled for the specified - validation keyword. This can be used to skip JSON schema structural validation - as requested in the configuration. - - Args: - schema_keyword (string): the name of a JSON schema validation keyword. - configuration (Configuration): the configuration class. - """ - - return (configuration is None or - not hasattr(configuration, '_disabled_client_side_validations') or - schema_keyword not in configuration._disabled_client_side_validations) - - -def check_validations( - validations, input_variable_path, input_values, - configuration=None): - """Raises an exception if the input_values are invalid - - Args: - validations (dict): the validation dictionary. - input_variable_path (tuple): the path to the input variable. - input_values (list/str/int/float/date/datetime): the values that we - are checking. - configuration (Configuration): the configuration class. - """ - - if input_values is None: - return - - current_validations = validations[input_variable_path] - if (is_json_validation_enabled('multipleOf', configuration) and - 'multiple_of' in current_validations and - isinstance(input_values, (int, float)) and - not (float(input_values) / current_validations['multiple_of']).is_integer()): - # Note 'multipleOf' will be as good as the floating point arithmetic. - raise ApiValueError( - "Invalid value for `%s`, value must be a multiple of " - "`%s`" % ( - input_variable_path[0], - current_validations['multiple_of'] - ) - ) - - if (is_json_validation_enabled('maxLength', configuration) and - 'max_length' in current_validations and - len(input_values) > current_validations['max_length']): - raise ApiValueError( - "Invalid value for `%s`, length must be less than or equal to " - "`%s`" % ( - input_variable_path[0], - current_validations['max_length'] - ) - ) - - if (is_json_validation_enabled('minLength', configuration) and - 'min_length' in current_validations and - len(input_values) < current_validations['min_length']): - raise ApiValueError( - "Invalid value for `%s`, length must be greater than or equal to " - "`%s`" % ( - input_variable_path[0], - current_validations['min_length'] - ) - ) - - if (is_json_validation_enabled('maxItems', configuration) and - 'max_items' in current_validations and - len(input_values) > current_validations['max_items']): - raise ApiValueError( - "Invalid value for `%s`, number of items must be less than or " - "equal to `%s`" % ( - input_variable_path[0], - current_validations['max_items'] - ) - ) - - if (is_json_validation_enabled('minItems', configuration) and - 'min_items' in current_validations and - len(input_values) < current_validations['min_items']): - raise ValueError( - "Invalid value for `%s`, number of items must be greater than or " - "equal to `%s`" % ( - input_variable_path[0], - current_validations['min_items'] - ) - ) - - items = ('exclusive_maximum', 'inclusive_maximum', 'exclusive_minimum', - 'inclusive_minimum') - if (any(item in current_validations for item in items)): - if isinstance(input_values, list): - max_val = max(input_values) - min_val = min(input_values) - elif isinstance(input_values, dict): - max_val = max(input_values.values()) - min_val = min(input_values.values()) - else: - max_val = input_values - min_val = input_values - - if (is_json_validation_enabled('exclusiveMaximum', configuration) and - 'exclusive_maximum' in current_validations and - max_val >= current_validations['exclusive_maximum']): - raise ApiValueError( - "Invalid value for `%s`, must be a value less than `%s`" % ( - input_variable_path[0], - current_validations['exclusive_maximum'] - ) - ) - - if (is_json_validation_enabled('maximum', configuration) and - 'inclusive_maximum' in current_validations and - max_val > current_validations['inclusive_maximum']): - raise ApiValueError( - "Invalid value for `%s`, must be a value less than or equal to " - "`%s`" % ( - input_variable_path[0], - current_validations['inclusive_maximum'] - ) - ) - - if (is_json_validation_enabled('exclusiveMinimum', configuration) and - 'exclusive_minimum' in current_validations and - min_val <= current_validations['exclusive_minimum']): - raise ApiValueError( - "Invalid value for `%s`, must be a value greater than `%s`" % - ( - input_variable_path[0], - current_validations['exclusive_maximum'] - ) - ) - - if (is_json_validation_enabled('minimum', configuration) and - 'inclusive_minimum' in current_validations and - min_val < current_validations['inclusive_minimum']): - raise ApiValueError( - "Invalid value for `%s`, must be a value greater than or equal " - "to `%s`" % ( - input_variable_path[0], - current_validations['inclusive_minimum'] - ) - ) - flags = current_validations.get('regex', {}).get('flags', 0) - if (is_json_validation_enabled('pattern', configuration) and - 'regex' in current_validations and - not re.search(current_validations['regex']['pattern'], - input_values, flags=flags)): - err_msg = r"Invalid value for `%s`, must match regular expression `%s`" % ( - input_variable_path[0], - current_validations['regex']['pattern'] - ) - if flags != 0: - # Don't print the regex flags if the flags are not - # specified in the OAS document. - err_msg = r"%s with flags=`%s`" % (err_msg, flags) - raise ApiValueError(err_msg) - - -def order_response_types(required_types): - """Returns the required types sorted in coercion order - - Args: - required_types (list/tuple): collection of classes or instance of - list or dict with class information inside it. - - Returns: - (list): coercion order sorted collection of classes or instance - of list or dict with class information inside it. - """ - - def index_getter(class_or_instance): - if isinstance(class_or_instance, list): - return COERCION_INDEX_BY_TYPE[list] - elif isinstance(class_or_instance, dict): - return COERCION_INDEX_BY_TYPE[dict] - elif (inspect.isclass(class_or_instance) - and issubclass(class_or_instance, ModelComposed)): - return COERCION_INDEX_BY_TYPE[ModelComposed] - elif (inspect.isclass(class_or_instance) - and issubclass(class_or_instance, ModelNormal)): - return COERCION_INDEX_BY_TYPE[ModelNormal] - elif (inspect.isclass(class_or_instance) - and issubclass(class_or_instance, ModelSimple)): - return COERCION_INDEX_BY_TYPE[ModelSimple] - elif class_or_instance in COERCION_INDEX_BY_TYPE: - return COERCION_INDEX_BY_TYPE[class_or_instance] - raise ApiValueError("Unsupported type: %s" % class_or_instance) - - sorted_types = sorted( - required_types, - key=lambda class_or_instance: index_getter(class_or_instance) - ) - return sorted_types - - -def remove_uncoercible(required_types_classes, current_item, spec_property_naming, - must_convert=True): - """Only keeps the type conversions that are possible - - Args: - required_types_classes (tuple): tuple of classes that are required - these should be ordered by COERCION_INDEX_BY_TYPE - spec_property_naming (bool): True if the variable names in the input - data are serialized names as specified in the OpenAPI document. - False if the variables names in the input data are python - variable names in PEP-8 snake case. - current_item (any): the current item (input data) to be converted - - Keyword Args: - must_convert (bool): if True the item to convert is of the wrong - type and we want a big list of coercibles - if False, we want a limited list of coercibles - - Returns: - (list): the remaining coercible required types, classes only - """ - current_type_simple = get_simple_class(current_item) - - results_classes = [] - for required_type_class in required_types_classes: - # convert our models to OpenApiModel - required_type_class_simplified = required_type_class - if isinstance(required_type_class_simplified, type): - if issubclass(required_type_class_simplified, ModelComposed): - required_type_class_simplified = ModelComposed - elif issubclass(required_type_class_simplified, ModelNormal): - required_type_class_simplified = ModelNormal - elif issubclass(required_type_class_simplified, ModelSimple): - required_type_class_simplified = ModelSimple - - if required_type_class_simplified == current_type_simple: - # don't consider converting to one's own class - continue - - class_pair = (current_type_simple, required_type_class_simplified) - if must_convert and class_pair in COERCIBLE_TYPE_PAIRS[spec_property_naming]: - results_classes.append(required_type_class) - elif class_pair in UPCONVERSION_TYPE_PAIRS: - results_classes.append(required_type_class) - return results_classes - -def get_discriminated_classes(cls): - """ - Returns all the classes that a discriminator converts to - TODO: lru_cache this - """ - possible_classes = [] - key = list(cls.discriminator.keys())[0] - if is_type_nullable(cls): - possible_classes.append(cls) - for discr_cls in cls.discriminator[key].values(): - if hasattr(discr_cls, 'discriminator') and discr_cls.discriminator is not None: - possible_classes.extend(get_discriminated_classes(discr_cls)) - else: - possible_classes.append(discr_cls) - return possible_classes - - -def get_possible_classes(cls, from_server_context): - # TODO: lru_cache this - possible_classes = [cls] - if from_server_context: - return possible_classes - if hasattr(cls, 'discriminator') and cls.discriminator is not None: - possible_classes = [] - possible_classes.extend(get_discriminated_classes(cls)) - elif issubclass(cls, ModelComposed): - possible_classes.extend(composed_model_input_classes(cls)) - return possible_classes - - -def get_required_type_classes(required_types_mixed, spec_property_naming): - """Converts the tuple required_types into a tuple and a dict described - below - - Args: - required_types_mixed (tuple/list): will contain either classes or - instance of list or dict - spec_property_naming (bool): if True these values came from the - server, and we use the data types in our endpoints. - If False, we are client side and we need to include - oneOf and discriminator classes inside the data types in our endpoints - - Returns: - (valid_classes, dict_valid_class_to_child_types_mixed): - valid_classes (tuple): the valid classes that the current item - should be - dict_valid_class_to_child_types_mixed (dict): - valid_class (class): this is the key - child_types_mixed (list/dict/tuple): describes the valid child - types - """ - valid_classes = [] - child_req_types_by_current_type = {} - for required_type in required_types_mixed: - if isinstance(required_type, list): - valid_classes.append(list) - child_req_types_by_current_type[list] = required_type - elif isinstance(required_type, tuple): - valid_classes.append(tuple) - child_req_types_by_current_type[tuple] = required_type - elif isinstance(required_type, dict): - valid_classes.append(dict) - child_req_types_by_current_type[dict] = required_type[str] - else: - valid_classes.extend(get_possible_classes(required_type, spec_property_naming)) - return tuple(valid_classes), child_req_types_by_current_type - - -def change_keys_js_to_python(input_dict, model_class): - """ - Converts from javascript_key keys in the input_dict to python_keys in - the output dict using the mapping in model_class. - If the input_dict contains a key which does not declared in the model_class, - the key is added to the output dict as is. The assumption is the model_class - may have undeclared properties (additionalProperties attribute in the OAS - document). - """ - - if getattr(model_class, 'attribute_map', None) is None: - return input_dict - output_dict = {} - reversed_attr_map = {value: key for key, value in - model_class.attribute_map.items()} - for javascript_key, value in input_dict.items(): - python_key = reversed_attr_map.get(javascript_key) - if python_key is None: - # if the key is unknown, it is in error or it is an - # additionalProperties variable - python_key = javascript_key - output_dict[python_key] = value - return output_dict - - -def get_type_error(var_value, path_to_item, valid_classes, key_type=False): - error_msg = type_error_message( - var_name=path_to_item[-1], - var_value=var_value, - valid_classes=valid_classes, - key_type=key_type - ) - return ApiTypeError( - error_msg, - path_to_item=path_to_item, - valid_classes=valid_classes, - key_type=key_type - ) - - -def deserialize_primitive(data, klass, path_to_item): - """Deserializes string to primitive type. - - :param data: str/int/float - :param klass: str/class the class to convert to - - :return: int, float, str, bool, date, datetime - """ - additional_message = "" - try: - if klass in {datetime, date}: - additional_message = ( - "If you need your parameter to have a fallback " - "string value, please set its type as `type: {}` in your " - "spec. That allows the value to be any type. " - ) - if klass == datetime: - if len(data) < 8: - raise ValueError("This is not a datetime") - # The string should be in iso8601 datetime format. - parsed_datetime = parse(data) - date_only = ( - parsed_datetime.hour == 0 and - parsed_datetime.minute == 0 and - parsed_datetime.second == 0 and - parsed_datetime.tzinfo is None and - 8 <= len(data) <= 10 - ) - if date_only: - raise ValueError("This is a date, not a datetime") - return parsed_datetime - elif klass == date: - if len(data) < 8: - raise ValueError("This is not a date") - return parse(data).date() - else: - converted_value = klass(data) - if isinstance(data, str) and klass == float: - if str(converted_value) != data: - # '7' -> 7.0 -> '7.0' != '7' - raise ValueError('This is not a float') - return converted_value - except (OverflowError, ValueError) as ex: - # parse can raise OverflowError - raise ApiValueError( - "{0}Failed to parse {1} as {2}".format( - additional_message, repr(data), klass.__name__ - ), - path_to_item=path_to_item - ) from ex - - -def get_discriminator_class(model_class, - discr_name, - discr_value, cls_visited): - """Returns the child class specified by the discriminator. - - Args: - model_class (OpenApiModel): the model class. - discr_name (string): the name of the discriminator property. - discr_value (any): the discriminator value. - cls_visited (list): list of model classes that have been visited. - Used to determine the discriminator class without - visiting circular references indefinitely. - - Returns: - used_model_class (class/None): the chosen child class that will be used - to deserialize the data, for example dog.Dog. - If a class is not found, None is returned. - """ - - if model_class in cls_visited: - # The class has already been visited and no suitable class was found. - return None - cls_visited.append(model_class) - used_model_class = None - if discr_name in model_class.discriminator: - class_name_to_discr_class = model_class.discriminator[discr_name] - used_model_class = class_name_to_discr_class.get(discr_value) - if used_model_class is None: - # We didn't find a discriminated class in class_name_to_discr_class. - # So look in the ancestor or descendant discriminators - # The discriminator mapping may exist in a descendant (anyOf, oneOf) - # or ancestor (allOf). - # Ancestor example: in the GrandparentAnimal -> ParentPet -> ChildCat - # hierarchy, the discriminator mappings may be defined at any level - # in the hierarchy. - # Descendant example: mammal -> whale/zebra/Pig -> BasquePig/DanishPig - # if we try to make BasquePig from mammal, we need to travel through - # the oneOf descendant discriminators to find BasquePig - descendant_classes = model_class._composed_schemas.get('oneOf', ()) + \ - model_class._composed_schemas.get('anyOf', ()) - ancestor_classes = model_class._composed_schemas.get('allOf', ()) - possible_classes = descendant_classes + ancestor_classes - for cls in possible_classes: - # Check if the schema has inherited discriminators. - if hasattr(cls, 'discriminator') and cls.discriminator is not None: - used_model_class = get_discriminator_class( - cls, discr_name, discr_value, cls_visited) - if used_model_class is not None: - return used_model_class - return used_model_class - - -def deserialize_model(model_data, model_class, path_to_item, check_type, - configuration, spec_property_naming): - """Deserializes model_data to model instance. - - Args: - model_data (int/str/float/bool/none_type/list/dict): data to instantiate the model - model_class (OpenApiModel): the model class - path_to_item (list): path to the model in the received data - check_type (bool): whether to check the data tupe for the values in - the model - configuration (Configuration): the instance to use to convert files - spec_property_naming (bool): True if the variable names in the input - data are serialized names as specified in the OpenAPI document. - False if the variables names in the input data are python - variable names in PEP-8 snake case. - - Returns: - model instance - - Raise: - ApiTypeError - ApiValueError - ApiKeyError - """ - - kw_args = dict(_check_type=check_type, - _path_to_item=path_to_item, - _configuration=configuration, - _spec_property_naming=spec_property_naming) - - if issubclass(model_class, ModelSimple): - return model_class(model_data, **kw_args) - elif isinstance(model_data, list): - return model_class(*model_data, **kw_args) - if isinstance(model_data, dict): - kw_args.update(model_data) - return model_class(**kw_args) - elif isinstance(model_data, PRIMITIVE_TYPES): - return model_class(model_data, **kw_args) - - -def deserialize_file(response_data, configuration, content_disposition=None): - """Deserializes body to file - - Saves response body into a file in a temporary folder, - using the filename from the `Content-Disposition` header if provided. - - Args: - param response_data (str): the file data to write - configuration (Configuration): the instance to use to convert files - - Keyword Args: - content_disposition (str): the value of the Content-Disposition - header - - Returns: - (file_type): the deserialized file which is open - The user is responsible for closing and reading the file - """ - fd, path = tempfile.mkstemp(dir=configuration.temp_folder_path) - os.close(fd) - os.remove(path) - - if content_disposition: - filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', - content_disposition).group(1) - path = os.path.join(os.path.dirname(path), filename) - - with open(path, "wb") as f: - if isinstance(response_data, str): - # change str to bytes so we can write it - response_data = response_data.encode('utf-8') - f.write(response_data) - - f = open(path, "rb") - return f - - -def attempt_convert_item(input_value, valid_classes, path_to_item, - configuration, spec_property_naming, key_type=False, - must_convert=False, check_type=True): - """ - Args: - input_value (any): the data to convert - valid_classes (any): the classes that are valid - path_to_item (list): the path to the item to convert - configuration (Configuration): the instance to use to convert files - spec_property_naming (bool): True if the variable names in the input - data are serialized names as specified in the OpenAPI document. - False if the variables names in the input data are python - variable names in PEP-8 snake case. - key_type (bool): if True we need to convert a key type (not supported) - must_convert (bool): if True we must convert - check_type (bool): if True we check the type or the returned data in - ModelComposed/ModelNormal/ModelSimple instances - - Returns: - instance (any) the fixed item - - Raises: - ApiTypeError - ApiValueError - ApiKeyError - """ - valid_classes_ordered = order_response_types(valid_classes) - valid_classes_coercible = remove_uncoercible( - valid_classes_ordered, input_value, spec_property_naming) - if not valid_classes_coercible or key_type: - # we do not handle keytype errors, json will take care - # of this for us - if configuration is None or not configuration.discard_unknown_keys: - raise get_type_error(input_value, path_to_item, valid_classes, - key_type=key_type) - for valid_class in valid_classes_coercible: - try: - if issubclass(valid_class, OpenApiModel): - return deserialize_model(input_value, valid_class, - path_to_item, check_type, - configuration, spec_property_naming) - elif valid_class == file_type: - return deserialize_file(input_value, configuration) - return deserialize_primitive(input_value, valid_class, - path_to_item) - except (ApiTypeError, ApiValueError, ApiKeyError) as conversion_exc: - if must_convert: - raise conversion_exc - # if we have conversion errors when must_convert == False - # we ignore the exception and move on to the next class - continue - # we were unable to convert, must_convert == False - return input_value - - -def is_type_nullable(input_type): - """ - Returns true if None is an allowed value for the specified input_type. - - A type is nullable if at least one of the following conditions is true: - 1. The OAS 'nullable' attribute has been specified, - 1. The type is the 'null' type, - 1. The type is a anyOf/oneOf composed schema, and a child schema is - the 'null' type. - Args: - input_type (type): the class of the input_value that we are - checking - Returns: - bool - """ - if input_type is none_type: - return True - if issubclass(input_type, OpenApiModel) and input_type._nullable: - return True - if issubclass(input_type, ModelComposed): - # If oneOf/anyOf, check if the 'null' type is one of the allowed types. - for t in input_type._composed_schemas.get('oneOf', ()): - if is_type_nullable(t): return True - for t in input_type._composed_schemas.get('anyOf', ()): - if is_type_nullable(t): return True - return False - - -def is_valid_type(input_class_simple, valid_classes): - """ - Args: - input_class_simple (class): the class of the input_value that we are - checking - valid_classes (tuple): the valid classes that the current item - should be - Returns: - bool - """ - valid_type = input_class_simple in valid_classes - if not valid_type and ( - issubclass(input_class_simple, OpenApiModel) or - input_class_simple is none_type): - for valid_class in valid_classes: - if valid_class is object: - # this is to handle oneOf fields in a Model. AAPI team added this if condition to handle Quant API - return True - if input_class_simple is none_type and is_type_nullable(valid_class): - # Schema is oneOf/anyOf and the 'null' type is one of the allowed types. - return True - if not (issubclass(valid_class, OpenApiModel) and valid_class.discriminator): - continue - discr_propertyname_py = list(valid_class.discriminator.keys())[0] - discriminator_classes = ( - valid_class.discriminator[discr_propertyname_py].values() - ) - valid_type = is_valid_type(input_class_simple, discriminator_classes) - if valid_type: - return True - return valid_type - - -def validate_and_convert_types(input_value, required_types_mixed, path_to_item, - spec_property_naming, _check_type, configuration=None): - """Raises a TypeError is there is a problem, otherwise returns value - - Args: - input_value (any): the data to validate/convert - required_types_mixed (list/dict/tuple): A list of - valid classes, or a list tuples of valid classes, or a dict where - the value is a tuple of value classes - path_to_item: (list) the path to the data being validated - this stores a list of keys or indices to get to the data being - validated - spec_property_naming (bool): True if the variable names in the input - data are serialized names as specified in the OpenAPI document. - False if the variables names in the input data are python - variable names in PEP-8 snake case. - _check_type: (boolean) if true, type will be checked and conversion - will be attempted. - configuration: (Configuration): the configuration class to use - when converting file_type items. - If passed, conversion will be attempted when possible - If not passed, no conversions will be attempted and - exceptions will be raised - - Returns: - the correctly typed value - - Raises: - ApiTypeError - """ - results = get_required_type_classes(required_types_mixed, spec_property_naming) - valid_classes, child_req_types_by_current_type = results - - input_class_simple = get_simple_class(input_value) - valid_type = is_valid_type(input_class_simple, valid_classes) - if not valid_type: - if configuration: - # if input_value is not valid_type try to convert it - converted_instance = attempt_convert_item( - input_value, - valid_classes, - path_to_item, - configuration, - spec_property_naming, - key_type=False, - must_convert=True, - check_type=_check_type - ) - return converted_instance - else: - raise get_type_error(input_value, path_to_item, valid_classes, - key_type=False) - - # input_value's type is in valid_classes - if len(valid_classes) > 1 and configuration: - # there are valid classes which are not the current class - valid_classes_coercible = remove_uncoercible( - valid_classes, input_value, spec_property_naming, must_convert=False) - if valid_classes_coercible: - converted_instance = attempt_convert_item( - input_value, - valid_classes_coercible, - path_to_item, - configuration, - spec_property_naming, - key_type=False, - must_convert=False, - check_type=_check_type - ) - return converted_instance - - if child_req_types_by_current_type == {}: - # all types are of the required types and there are no more inner - # variables left to look at - return input_value - inner_required_types = child_req_types_by_current_type.get( - type(input_value) - ) - if inner_required_types is None: - # for this type, there are not more inner variables left to look at - return input_value - if isinstance(input_value, list): - if input_value == []: - # allow an empty list - return input_value - for index, inner_value in enumerate(input_value): - inner_path = list(path_to_item) - inner_path.append(index) - input_value[index] = validate_and_convert_types( - inner_value, - inner_required_types, - inner_path, - spec_property_naming, - _check_type, - configuration=configuration - ) - elif isinstance(input_value, dict): - if input_value == {}: - # allow an empty dict - return input_value - for inner_key, inner_val in input_value.items(): - inner_path = list(path_to_item) - inner_path.append(inner_key) - if get_simple_class(inner_key) != str: - raise get_type_error(inner_key, inner_path, valid_classes, - key_type=True) - input_value[inner_key] = validate_and_convert_types( - inner_val, - inner_required_types, - inner_path, - spec_property_naming, - _check_type, - configuration=configuration - ) - return input_value - - -def model_to_dict(model_instance, serialize=True): - """Returns the model properties as a dict - - Args: - model_instance (one of your model instances): the model instance that - will be converted to a dict. - - Keyword Args: - serialize (bool): if True, the keys in the dict will be values from - attribute_map - """ - result = {} - - model_instances = [model_instance] - if model_instance._composed_schemas: - model_instances.extend(model_instance._composed_instances) - for model_instance in model_instances: - for attr, value in model_instance._data_store.items(): - if serialize: - # we use get here because additional property key names do not - # exist in attribute_map - attr = model_instance.attribute_map.get(attr, attr) - if isinstance(value, list): - if not value or isinstance(value[0], PRIMITIVE_TYPES): - # empty list or primitive types - result[attr] = value - elif isinstance(value[0], ModelSimple): - result[attr] = [x.value for x in value] - else: - result[attr] = [model_to_dict(x, serialize=serialize) for x in value] - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], - model_to_dict(item[1], serialize=serialize)) - if hasattr(item[1], '_data_store') else item, - value.items() - )) - elif isinstance(value, ModelSimple): - result[attr] = value.value - elif hasattr(value, '_data_store'): - result[attr] = model_to_dict(value, serialize=serialize) - else: - result[attr] = value - - return result - - -def type_error_message(var_value=None, var_name=None, valid_classes=None, - key_type=None): - """ - Keyword Args: - var_value (any): the variable which has the type_error - var_name (str): the name of the variable which has the typ error - valid_classes (tuple): the accepted classes for current_item's - value - key_type (bool): False if our value is a value in a dict - True if it is a key in a dict - False if our item is an item in a list - """ - key_or_value = 'value' - if key_type: - key_or_value = 'key' - valid_classes_phrase = get_valid_classes_phrase(valid_classes) - msg = ( - "Invalid type for variable '{0}'. Required {1} type {2} and " - "passed type was {3}".format( - var_name, - key_or_value, - valid_classes_phrase, - type(var_value).__name__, - ) - ) - return msg - - -def get_valid_classes_phrase(input_classes): - """Returns a string phrase describing what types are allowed - """ - all_classes = list(input_classes) - all_classes = sorted(all_classes, key=lambda cls: cls.__name__) - all_class_names = [cls.__name__ for cls in all_classes] - if len(all_class_names) == 1: - return 'is {0}'.format(all_class_names[0]) - return "is one of [{0}]".format(", ".join(all_class_names)) - - -def convert_js_args_to_python_args(fn): - from functools import wraps - @wraps(fn) - def wrapped_init(self, *args, **kwargs): - spec_property_naming = kwargs.get('_spec_property_naming', False) - if spec_property_naming: - kwargs = change_keys_js_to_python(kwargs, self.__class__) - return fn(self, *args, **kwargs) - return wrapped_init - - -def get_allof_instances(self, model_args, constant_args): - """ - Args: - self: the class we are handling - model_args (dict): var_name to var_value - used to make instances - constant_args (dict): var_name to var_value - used to make instances - - Returns - composed_instances (list) - """ - composed_instances = [] - for allof_class in self._composed_schemas['allOf']: - - # no need to handle changing js keys to python because - # for composed schemas, allof parameters are included in the - # composed schema and were changed to python keys in __new__ - # extract a dict of only required keys from fixed_model_args - kwargs = {} - var_names = set(allof_class.openapi_types.keys()) - for var_name in var_names: - if var_name in model_args: - kwargs[var_name] = model_args[var_name] - - # and use it to make the instance - kwargs.update(constant_args) - try: - allof_instance = allof_class(**kwargs) - composed_instances.append(allof_instance) - except Exception as ex: - raise ApiValueError( - "Invalid inputs given to generate an instance of '%s'. The " - "input data was invalid for the allOf schema '%s' in the composed " - "schema '%s'. Error=%s" % ( - allof_class.__name__, - allof_class.__name__, - self.__class__.__name__, - str(ex) - ) - ) from ex - return composed_instances - - -def get_oneof_instance(cls, model_kwargs, constant_kwargs, model_arg=None): - """ - Find the oneOf schema that matches the input data (e.g. payload). - If exactly one schema matches the input data, an instance of that schema - is returned. - If zero or more than one schema match the input data, an exception is raised. - In OAS 3.x, the payload MUST, by validation, match exactly one of the - schemas described by oneOf. - - Args: - cls: the class we are handling - model_kwargs (dict): var_name to var_value - The input data, e.g. the payload that must match a oneOf schema - in the OpenAPI document. - constant_kwargs (dict): var_name to var_value - args that every model requires, including configuration, server - and path to item. - - Kwargs: - model_arg: (int, float, bool, str, date, datetime, ModelSimple, None): - the value to assign to a primitive class or ModelSimple class - Notes: - - this is only passed in when oneOf includes types which are not object - - None is used to suppress handling of model_arg, nullable models are handled in __new__ - - Returns - oneof_instance (instance) - """ - if len(cls._composed_schemas['oneOf']) == 0: - return None - - oneof_instances = [] - # Iterate over each oneOf schema and determine if the input data - # matches the oneOf schemas. - for oneof_class in cls._composed_schemas['oneOf']: - # The composed oneOf schema allows the 'null' type and the input data - # is the null value. This is a OAS >= 3.1 feature. - if oneof_class is none_type: - # skip none_types because we are deserializing dict data. - # none_type deserialization is handled in the __new__ method - continue - - single_value_input = allows_single_value_input(oneof_class) - - if not single_value_input: - # transform js keys from input data to python keys in fixed_model_args - fixed_model_args = change_keys_js_to_python( - model_kwargs, oneof_class) - - # Extract a dict with the properties that are declared in the oneOf schema. - # Undeclared properties (e.g. properties that are allowed because of the - # additionalProperties attribute in the OAS document) are not added to - # the dict. - kwargs = {} - var_names = set(oneof_class.openapi_types.keys()) - for var_name in var_names: - if var_name in fixed_model_args: - kwargs[var_name] = fixed_model_args[var_name] - - # do not try to make a model with no input args - if len(kwargs) == 0: - continue - - # and use it to make the instance - kwargs.update(constant_kwargs) - - try: - if not single_value_input: - oneof_instance = oneof_class(**kwargs) - else: - if issubclass(oneof_class, ModelSimple): - oneof_instance = oneof_class(model_arg, **constant_kwargs) - elif oneof_class in PRIMITIVE_TYPES: - oneof_instance = validate_and_convert_types( - model_arg, - (oneof_class,), - constant_kwargs['_path_to_item'], - constant_kwargs['_spec_property_naming'], - constant_kwargs['_check_type'], - configuration=constant_kwargs['_configuration'] - ) - oneof_instances.append(oneof_instance) - except Exception: - pass - if len(oneof_instances) == 0: - raise ApiValueError( - "Invalid inputs given to generate an instance of %s. None " - "of the oneOf schemas matched the input data." % - cls.__name__ - ) - elif len(oneof_instances) > 1: - raise ApiValueError( - "Invalid inputs given to generate an instance of %s. Multiple " - "oneOf schemas matched the inputs, but a max of one is allowed." % - cls.__name__ - ) - return oneof_instances[0] - - -def get_anyof_instances(self, model_args, constant_args): - """ - Args: - self: the class we are handling - model_args (dict): var_name to var_value - The input data, e.g. the payload that must match at least one - anyOf child schema in the OpenAPI document. - constant_args (dict): var_name to var_value - args that every model requires, including configuration, server - and path to item. - - Returns - anyof_instances (list) - """ - anyof_instances = [] - if len(self._composed_schemas['anyOf']) == 0: - return anyof_instances - - for anyof_class in self._composed_schemas['anyOf']: - # The composed oneOf schema allows the 'null' type and the input data - # is the null value. This is a OAS >= 3.1 feature. - if anyof_class is none_type: - # skip none_types because we are deserializing dict data. - # none_type deserialization is handled in the __new__ method - continue - - # transform js keys to python keys in fixed_model_args - fixed_model_args = change_keys_js_to_python(model_args, anyof_class) - - # extract a dict of only required keys from these_model_vars - kwargs = {} - var_names = set(anyof_class.openapi_types.keys()) - for var_name in var_names: - if var_name in fixed_model_args: - kwargs[var_name] = fixed_model_args[var_name] - - # do not try to make a model with no input args - if len(kwargs) == 0: - continue - - # and use it to make the instance - kwargs.update(constant_args) - try: - anyof_instance = anyof_class(**kwargs) - anyof_instances.append(anyof_instance) - except Exception: - pass - if len(anyof_instances) == 0: - raise ApiValueError( - "Invalid inputs given to generate an instance of %s. None of the " - "anyOf schemas matched the inputs." % - self.__class__.__name__ - ) - return anyof_instances - - -def get_additional_properties_model_instances( - composed_instances, self): - additional_properties_model_instances = [] - all_instances = [self] - all_instances.extend(composed_instances) - for instance in all_instances: - if instance.additional_properties_type is not None: - additional_properties_model_instances.append(instance) - return additional_properties_model_instances - - -def get_var_name_to_model_instances(self, composed_instances): - var_name_to_model_instances = {} - all_instances = [self] - all_instances.extend(composed_instances) - for instance in all_instances: - for var_name in instance.openapi_types: - if var_name not in var_name_to_model_instances: - var_name_to_model_instances[var_name] = [instance] - else: - var_name_to_model_instances[var_name].append(instance) - return var_name_to_model_instances - - -def get_unused_args(self, composed_instances, model_args): - unused_args = dict(model_args) - # arguments apssed to self were already converted to python names - # before __init__ was called - for var_name_py in self.attribute_map: - if var_name_py in unused_args: - del unused_args[var_name_py] - for instance in composed_instances: - if instance.__class__ in self._composed_schemas['allOf']: - for var_name_py in instance.attribute_map: - if var_name_py in unused_args: - del unused_args[var_name_py] - else: - for var_name_js in instance.attribute_map.values(): - if var_name_js in unused_args: - del unused_args[var_name_js] - return unused_args - - -def validate_get_composed_info(constant_args, model_args, self): - """ - For composed schemas, generate schema instances for - all schemas in the oneOf/anyOf/allOf definition. If additional - properties are allowed, also assign those properties on - all matched schemas that contain additionalProperties. - Openapi schemas are python classes. - - Exceptions are raised if: - - 0 or > 1 oneOf schema matches the model_args input data - - no anyOf schema matches the model_args input data - - any of the allOf schemas do not match the model_args input data - - Args: - constant_args (dict): these are the args that every model requires - model_args (dict): these are the required and optional spec args that - were passed in to make this model - self (class): the class that we are instantiating - This class contains self._composed_schemas - - Returns: - composed_info (list): length three - composed_instances (list): the composed instances which are not - self - var_name_to_model_instances (dict): a dict going from var_name - to the model_instance which holds that var_name - the model_instance may be self or an instance of one of the - classes in self.composed_instances() - additional_properties_model_instances (list): a list of the - model instances which have the property - additional_properties_type. This list can include self - """ - # create composed_instances - composed_instances = [] - allof_instances = get_allof_instances(self, model_args, constant_args) - composed_instances.extend(allof_instances) - oneof_instance = get_oneof_instance(self.__class__, model_args, constant_args) - if oneof_instance is not None: - composed_instances.append(oneof_instance) - anyof_instances = get_anyof_instances(self, model_args, constant_args) - composed_instances.extend(anyof_instances) - - # map variable names to composed_instances - var_name_to_model_instances = get_var_name_to_model_instances( - self, composed_instances) - - # set additional_properties_model_instances - additional_properties_model_instances = ( - get_additional_properties_model_instances(composed_instances, self) - ) - - # set any remaining values - unused_args = get_unused_args(self, composed_instances, model_args) - if len(unused_args) > 0 and \ - len(additional_properties_model_instances) == 0 and \ - (self._configuration is None or - not self._configuration.discard_unknown_keys): - raise ApiValueError( - "Invalid input arguments input when making an instance of " - "class %s. Not all inputs were used. The unused input data " - "is %s" % (self.__class__.__name__, unused_args) - ) - - # no need to add additional_properties to var_name_to_model_instances here - # because additional_properties_model_instances will direct us to that - # instance when we use getattr or setattr - # and we update var_name_to_model_instances in setattr - - return [ - composed_instances, - var_name_to_model_instances, - additional_properties_model_instances, - unused_args - ] \ No newline at end of file From e8a4afa1114143d2fc34a6305c658b90cef1b170 Mon Sep 17 00:00:00 2001 From: Sai Giridhar P Date: Tue, 28 Dec 2021 07:39:57 +0530 Subject: [PATCH 07/12] fix(config): Enabling discriminator --- languages/dotnet/openapi-generator-config.json | 1 + 1 file changed, 1 insertion(+) diff --git a/languages/dotnet/openapi-generator-config.json b/languages/dotnet/openapi-generator-config.json index 6f1bf87..501e70e 100644 --- a/languages/dotnet/openapi-generator-config.json +++ b/languages/dotnet/openapi-generator-config.json @@ -4,6 +4,7 @@ "packageGuid": "{D7309227-518B-45ED-896A-4853BE6A9075}", "targetFramework": "netstandard2.0", "caseInsensitiveResponseHeaders": true, + "useOneOfDiscriminatorLookup": true, "packageAuthors": "FactSet", "packageTitle": "FactSet Analytics Engines API", "packageDescription": "Allow clients to fetch Engines Analytics through APIs.", From 7d1a051630db99991ce09c3bd21d161d67d3172b Mon Sep 17 00:00:00 2001 From: Sai Giridhar P Date: Tue, 28 Dec 2021 09:52:40 +0530 Subject: [PATCH 08/12] fix(config): Enabling discriminator --- languages/java/openapi-generator-config.json | 1 + openapi-schema.json | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/languages/java/openapi-generator-config.json b/languages/java/openapi-generator-config.json index 77966cf..7ccf1c0 100644 --- a/languages/java/openapi-generator-config.json +++ b/languages/java/openapi-generator-config.json @@ -22,6 +22,7 @@ "useGzipFeature": false, "hideGenerationTimestamp": true, "caseInsensitiveResponseHeaders": true, + "legacyDiscriminatorBehavior": false, "library": "jersey2", "servers": false, "httpUserAgent": "engines-api/5.2.0/java" diff --git a/openapi-schema.json b/openapi-schema.json index ff231fd..a11edcc 100644 --- a/openapi-schema.json +++ b/openapi-schema.json @@ -41083,11 +41083,11 @@ }, "QuantUniverse": { "required": [ - "source" + "className" ], "type": "object", "properties": { - "source": { + "className": { "enum": [ "ScreeningExpressionUniverse", "UniversalScreenUniverse", @@ -41136,11 +41136,11 @@ "required": [ "calendar", "frequency", - "source" + "className" ], "type": "object", "properties": { - "source": { + "className": { "enum": [ "FdsDate", "DateList" @@ -41230,11 +41230,11 @@ }, "QuantFormula": { "required": [ - "source" + "className" ], "type": "object", "properties": { - "source": { + "className": { "enum": [ "ScreeningExpression", "FqlExpression", @@ -41463,7 +41463,7 @@ } ], "discriminator": { - "propertyName": "source", + "propertyName": "className", "mapping": { "UniversalScreenUniverse": "#/components/schemas/QuantUniversalScreenUniverse", "ScreeningExpressionUniverse": "#/components/schemas/QuantScreeningExpressionUniverse", @@ -41481,7 +41481,7 @@ } ], "discriminator": { - "propertyName": "source", + "propertyName": "className", "mapping": { "FdsDate": "#/components/schemas/QuantFdsDate", "DateList": "#/components/schemas/QuantDateList" @@ -41506,7 +41506,7 @@ } ], "discriminator": { - "propertyName": "source", + "propertyName": "className", "mapping": { "ScreeningExpression": "#/components/schemas/QuantScreeningExpression", "FqlExpression": "#/components/schemas/QuantFqlExpression", From 72ce5f9468aab9452e66bd1b9f3bda320ce87627 Mon Sep 17 00:00:00 2001 From: Sai Giridhar P Date: Tue, 28 Dec 2021 10:38:34 +0530 Subject: [PATCH 09/12] fix(config): Enabling discriminator for java --- languages/dotnet/openapi-generator-config.json | 3 ++- languages/java/openapi-generator-config.json | 3 ++- openapi-schema.json | 18 +++++++++--------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/languages/dotnet/openapi-generator-config.json b/languages/dotnet/openapi-generator-config.json index 501e70e..4c476d5 100644 --- a/languages/dotnet/openapi-generator-config.json +++ b/languages/dotnet/openapi-generator-config.json @@ -17,5 +17,6 @@ "licenseId": "Apache-2.0", "releaseNote": "Refer to Changelog on GitHub source repository", "packageTags": "PA;Vault;SPAR;Engines;FactSet;FDS;API;Analytics;AnalyticsAPI", - "httpUserAgent": "engines-api/5.2.0/csharp" + "httpUserAgent": "engines-api/5.2.0/csharp", + "disallowAdditionalPropertiesIfNotPresent": false } diff --git a/languages/java/openapi-generator-config.json b/languages/java/openapi-generator-config.json index 7ccf1c0..900617f 100644 --- a/languages/java/openapi-generator-config.json +++ b/languages/java/openapi-generator-config.json @@ -22,7 +22,8 @@ "useGzipFeature": false, "hideGenerationTimestamp": true, "caseInsensitiveResponseHeaders": true, - "legacyDiscriminatorBehavior": false, + "useOneOfDiscriminatorLookup": true, + "disallowAdditionalPropertiesIfNotPresent": false, "library": "jersey2", "servers": false, "httpUserAgent": "engines-api/5.2.0/java" diff --git a/openapi-schema.json b/openapi-schema.json index a11edcc..ff231fd 100644 --- a/openapi-schema.json +++ b/openapi-schema.json @@ -41083,11 +41083,11 @@ }, "QuantUniverse": { "required": [ - "className" + "source" ], "type": "object", "properties": { - "className": { + "source": { "enum": [ "ScreeningExpressionUniverse", "UniversalScreenUniverse", @@ -41136,11 +41136,11 @@ "required": [ "calendar", "frequency", - "className" + "source" ], "type": "object", "properties": { - "className": { + "source": { "enum": [ "FdsDate", "DateList" @@ -41230,11 +41230,11 @@ }, "QuantFormula": { "required": [ - "className" + "source" ], "type": "object", "properties": { - "className": { + "source": { "enum": [ "ScreeningExpression", "FqlExpression", @@ -41463,7 +41463,7 @@ } ], "discriminator": { - "propertyName": "className", + "propertyName": "source", "mapping": { "UniversalScreenUniverse": "#/components/schemas/QuantUniversalScreenUniverse", "ScreeningExpressionUniverse": "#/components/schemas/QuantScreeningExpressionUniverse", @@ -41481,7 +41481,7 @@ } ], "discriminator": { - "propertyName": "className", + "propertyName": "source", "mapping": { "FdsDate": "#/components/schemas/QuantFdsDate", "DateList": "#/components/schemas/QuantDateList" @@ -41506,7 +41506,7 @@ } ], "discriminator": { - "propertyName": "className", + "propertyName": "source", "mapping": { "ScreeningExpression": "#/components/schemas/QuantScreeningExpression", "FqlExpression": "#/components/schemas/QuantFqlExpression", From 23aeb59f8dc3d95395a1ede27fe15abf187d24a7 Mon Sep 17 00:00:00 2001 From: Sai Giridhar P Date: Tue, 28 Dec 2021 11:10:14 +0530 Subject: [PATCH 10/12] fix(config): Enabling discriminator --- openapi-schema.json | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/openapi-schema.json b/openapi-schema.json index ff231fd..cc7e813 100644 --- a/openapi-schema.json +++ b/openapi-schema.json @@ -41447,10 +41447,7 @@ "type": "object", "additionalProperties": false }, - "QuantCalculationParameters": { - "type": "object", - "properties": { - "universe": { + "DummyUniverse" : { "oneOf": [ { "$ref": "#/components/schemas/QuantUniversalScreenUniverse" @@ -41470,6 +41467,14 @@ "IdentifierUniverse": "#/components/schemas/QuantIdentifierUniverse" } } + + }, + "QuantCalculationParameters": { + "type": "object", + "properties": { + "universe": { + "$ref": "#/components/schemas/DummyUniverse" + }, "dates": { "oneOf": [ From 9965b4257b8f297e8bd06a115c2a52cd30d1b7be Mon Sep 17 00:00:00 2001 From: Sai Giridhar P Date: Wed, 29 Dec 2021 14:50:08 +0530 Subject: [PATCH 11/12] fix(config): New schema --- openapi-schema.json | 132 +++++++++++++++++++++++--------------------- 1 file changed, 68 insertions(+), 64 deletions(-) diff --git a/openapi-schema.json b/openapi-schema.json index cc7e813..ae2ad70 100644 --- a/openapi-schema.json +++ b/openapi-schema.json @@ -41447,79 +41447,83 @@ "type": "object", "additionalProperties": false }, - "DummyUniverse" : { - "oneOf": [ - { - "$ref": "#/components/schemas/QuantUniversalScreenUniverse" - }, - { - "$ref": "#/components/schemas/QuantScreeningExpressionUniverse" - }, - { - "$ref": "#/components/schemas/QuantIdentifierUniverse" - } - ], - "discriminator": { - "propertyName": "source", - "mapping": { - "UniversalScreenUniverse": "#/components/schemas/QuantUniversalScreenUniverse", - "ScreeningExpressionUniverse": "#/components/schemas/QuantScreeningExpressionUniverse", - "IdentifierUniverse": "#/components/schemas/QuantIdentifierUniverse" - } + "OneOfQuantUniverse": { + "oneOf": [ + { + "$ref": "#/components/schemas/QuantUniversalScreenUniverse" + }, + { + "$ref": "#/components/schemas/QuantScreeningExpressionUniverse" + }, + { + "$ref": "#/components/schemas/QuantIdentifierUniverse" + } + ], + "discriminator": { + "propertyName": "source", + "mapping": { + "UniversalScreenUniverse": "#/components/schemas/QuantUniversalScreenUniverse", + "ScreeningExpressionUniverse": "#/components/schemas/QuantScreeningExpressionUniverse", + "IdentifierUniverse": "#/components/schemas/QuantIdentifierUniverse" + } + } + }, + "OneOfQuantDates": { + "oneOf": [ + { + "$ref": "#/components/schemas/QuantFdsDate" + }, + { + "$ref": "#/components/schemas/QuantDateList" + } + ], + "discriminator": { + "propertyName": "source", + "mapping": { + "FdsDate": "#/components/schemas/QuantFdsDate", + "DateList": "#/components/schemas/QuantDateList" + } + } + }, + "OneOfQuantFormulas": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/QuantScreeningExpression" + }, + { + "$ref": "#/components/schemas/QuantFqlExpression" + }, + { + "$ref": "#/components/schemas/QuantUniversalScreenParameter" + }, + { + "$ref": "#/components/schemas/QuantAllUniversalScreenParameters" + } + ], + "discriminator": { + "propertyName": "source", + "mapping": { + "ScreeningExpression": "#/components/schemas/QuantScreeningExpression", + "FqlExpression": "#/components/schemas/QuantFqlExpression", + "UniversalScreenParameter": "#/components/schemas/QuantUniversalScreenParameter", + "AllUniversalScreenParameters": "#/components/schemas/QuantAllUniversalScreenParameters" } - - }, + } + } + }, "QuantCalculationParameters": { "type": "object", "properties": { "universe": { - "$ref": "#/components/schemas/DummyUniverse" - + "$ref": "#/components/schemas/OneOfQuantUniverse" }, "dates": { - "oneOf": [ - { - "$ref": "#/components/schemas/QuantFdsDate" - }, - { - "$ref": "#/components/schemas/QuantDateList" - } - ], - "discriminator": { - "propertyName": "source", - "mapping": { - "FdsDate": "#/components/schemas/QuantFdsDate", - "DateList": "#/components/schemas/QuantDateList" - } - } + "$ref": "#/components/schemas/OneOfQuantDates" }, "formulas": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/QuantScreeningExpression" - }, - { - "$ref": "#/components/schemas/QuantFqlExpression" - }, - { - "$ref": "#/components/schemas/QuantUniversalScreenParameter" - }, - { - "$ref": "#/components/schemas/QuantAllUniversalScreenParameters" - } - ], - "discriminator": { - "propertyName": "source", - "mapping": { - "ScreeningExpression": "#/components/schemas/QuantScreeningExpression", - "FqlExpression": "#/components/schemas/QuantFqlExpression", - "UniversalScreenParameter": "#/components/schemas/QuantUniversalScreenParameter", - "AllUniversalScreenParameters": "#/components/schemas/QuantAllUniversalScreenParameters" - } - } - } + "$ref": "#/components/schemas/OneOfQuantFormulas" } }, "additionalProperties": false From 21121307d80fd53cbfcf6fdee3f1c933fcac7250 Mon Sep 17 00:00:00 2001 From: Sai Giridhar P Date: Wed, 29 Dec 2021 16:18:28 +0530 Subject: [PATCH 12/12] fix(config): Enabling discriminator for array --- openapi-schema.json | 49 ++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/openapi-schema.json b/openapi-schema.json index ae2ad70..7c193df 100644 --- a/openapi-schema.json +++ b/openapi-schema.json @@ -41485,32 +41485,35 @@ } } }, + "OneOfQuantFormulasArray": { + "oneOf": [ + { + "$ref": "#/components/schemas/QuantScreeningExpression" + }, + { + "$ref": "#/components/schemas/QuantFqlExpression" + }, + { + "$ref": "#/components/schemas/QuantUniversalScreenParameter" + }, + { + "$ref": "#/components/schemas/QuantAllUniversalScreenParameters" + } + ], + "discriminator": { + "propertyName": "source", + "mapping": { + "ScreeningExpression": "#/components/schemas/QuantScreeningExpression", + "FqlExpression": "#/components/schemas/QuantFqlExpression", + "UniversalScreenParameter": "#/components/schemas/QuantUniversalScreenParameter", + "AllUniversalScreenParameters": "#/components/schemas/QuantAllUniversalScreenParameters" + } + } + }, "OneOfQuantFormulas": { "type": "array", "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/QuantScreeningExpression" - }, - { - "$ref": "#/components/schemas/QuantFqlExpression" - }, - { - "$ref": "#/components/schemas/QuantUniversalScreenParameter" - }, - { - "$ref": "#/components/schemas/QuantAllUniversalScreenParameters" - } - ], - "discriminator": { - "propertyName": "source", - "mapping": { - "ScreeningExpression": "#/components/schemas/QuantScreeningExpression", - "FqlExpression": "#/components/schemas/QuantFqlExpression", - "UniversalScreenParameter": "#/components/schemas/QuantUniversalScreenParameter", - "AllUniversalScreenParameters": "#/components/schemas/QuantAllUniversalScreenParameters" - } - } + "$ref": "#/components/schemas/OneOfQuantFormulasArray" } }, "QuantCalculationParameters": {