swagger-api / swagger-api/swagger-codegen
BUG : missing ref objects attributes in generated model
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Some ref objects attributes are missing while generating model from swagger spec.
-OBReadDataResponse1.java
Generated domain doesn't have fields "accountRequestId", "CreationDateTime", "Status", "StatusUpdateDateTime".
Swagger-codegen version
2.3.1
Swagger declaration file content or url
{
"swagger": "2.0",
"info": {
"title": "Account and Transaction API Specification",
"description": "Swagger for Account and Transaction API Specification",
"termsOfService": "https://www.openbanking.org.uk/terms",
"contact": {
"name": "Service Desk",
"email": "ServiceDesk@openbanking.org.uk"
},
"license": {
"name": "open-licence",
"url": "https://www.openbanking.org.uk/open-licence"
},
"version": "v2.0-rc3"
},
"basePath": "/open-banking/v2.0",
"tags": [
{
"name": "Account Requests",
"description": "Account Request"
}
],
"schemes": [
"https"
],
"consumes": [
"application/json; charset=utf-8"
],
"produces": [
"application/json; charset=utf-8"
],
"paths": {
"/account-requests": {
"post": {
"tags": [
"Account Requests"
],
"summary": "Create an account request",
"description": "Create an account request",
"operationId": "CreateAccountRequest",
"parameters": [
{
"$ref": "#/parameters/OBReadRequest1Param"
},
{
"$ref": "#/parameters/x-fapi-financial-id-Param"
},
{
"$ref": "#/parameters/x-fapi-customer-last-logged-time-Param"
},
{
"$ref": "#/parameters/x-fapi-customer-ip-address-Param"
},
{
"$ref": "#/parameters/x-fapi-interaction-id-Param"
},
{
"$ref": "#/parameters/AuthorizationParam"
},
{
"$ref": "#/parameters/x-jws-signature-Param"
}
],
"responses": {
"201": {
"$ref": "#/responses/201AccountRequestCreated"
},
"400": {
"$ref": "#/responses/400ErrorResponse"
},
"401": {
"$ref": "#/responses/401ErrorResponse"
},
"403": {
"$ref": "#/responses/403ErrorResponse"
},
"405": {
"$ref": "#/responses/405ErrorResponse"
},
"406": {
"$ref": "#/responses/406ErrorResponse"
},
"429": {
"$ref": "#/responses/429ErrorResponse"
},
"500": {
"$ref": "#/responses/500ErrorResponse"
}
},
"security": [
{
"TPPOAuth2Security": [
"accounts"
]
}
]
}
},
"/account-requests/{AccountRequestId}": {
"get": {
"tags": [
"Account Requests"
],
"summary": "Get an account request",
"description": "Get an account request",
"operationId": "GetAccountRequest",
"parameters": [
{
"$ref": "#/parameters/AccountRequestIdParam"
},
{
"$ref": "#/parameters/x-fapi-financial-id-Param"
},
{
"$ref": "#/parameters/x-fapi-customer-last-logged-time-Param"
},
{
"$ref": "#/parameters/x-fapi-customer-ip-address-Param"
},
{
"$ref": "#/parameters/x-fapi-interaction-id-Param"
},
{
"$ref": "#/parameters/AuthorizationParam"
}
],
"responses": {
"200": {
"$ref": "#/responses/200AccountRequestRead"
},
"400": {
"$ref": "#/responses/400ErrorResponse"
},
"401": {
"$ref": "#/responses/401ErrorResponse"
},
"403": {
"$ref": "#/responses/403ErrorResponse"
},
"405": {
"$ref": "#/responses/405ErrorResponse"
},
"406": {
"$ref": "#/responses/406ErrorResponse"
},
"429": {
"$ref": "#/responses/429ErrorResponse"
},
"500": {
"$ref": "#/responses/500ErrorResponse"
}
},
"security": [
{
"TPPOAuth2Security": [
"accounts"
]
}
]
},
"delete": {
"tags": [
"Account Requests"
],
"summary": "Delete an account request",
"description": "Delete an account request",
"operationId": "DeleteAccountRequest",
"parameters": [
{
"$ref": "#/parameters/AccountRequestIdParam"
},
{
"$ref": "#/parameters/x-fapi-financial-id-Param"
},
{
"$ref": "#/parameters/AuthorizationParam"
}
],
"responses": {
"204": {
"$ref": "#/responses/204AccountRequestDeleted"
},
"400": {
"$ref": "#/responses/400ErrorResponse"
},
"401": {
"$ref": "#/responses/401ErrorResponse"
},
"403": {
"$ref": "#/responses/403ErrorResponse"
},
"405": {
"$ref": "#/responses/405ErrorResponse"
},
"406": {
"$ref": "#/responses/406ErrorResponse"
},
"429": {
"$ref": "#/responses/429ErrorResponse"
},
"500": {
"$ref": "#/responses/500ErrorResponse"
}
},
"security": [
{
"TPPOAuth2Security": [
"accounts"
]
}
]
}
}
},
"parameters": {
"OBReadRequest1Param": {
"name": "OBReadRequest1",
"in": "body",
"description": "Create an Account Request",
"required": true,
"schema": {
"$ref": "#/definitions/OBReadRequest1"
}
},
"x-fapi-financial-id-Param": {
"in": "header",
"name": "x-fapi-financial-id",
"type": "string",
"required": true,
"description": "The unique id of the ASPSP to which the request is issued. The unique id will be issued by OB."
},
"x-fapi-customer-ip-address-Param": {
"in": "header",
"name": "x-fapi-customer-ip-address",
"type": "string",
"required": false,
"description": "The PSU's IP address if the PSU is currently logged in with the TPP."
},
"x-fapi-interaction-id-Param": {
"in": "header",
"name": "x-fapi-interaction-id",
"type": "string",
"required": false,
"description": "An RFC4122 UID used as a correlation id."
},
"x-fapi-customer-last-logged-time-Param": {
"in": "header",
"name": "x-fapi-customer-last-logged-time",
"type": "string",
"required": false,
"description": "The time when the PSU last logged in with the TPP. \nAll dates in the HTTP headers are represented as RFC 7231 Full Dates. An example is below: \nSun, 10 Sep 2017 19:43:31 UTC",
"pattern": "^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), \\d{2} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \\d{4} \\d{2}:\\d{2}:\\d{2} (GMT|UTC)$"
},
"AuthorizationParam": {
"in": "header",
"name": "Authorization",
"type": "string",
"required": true,
"description": "An Authorisation Token as per https://tools.ietf.org/html/rfc6750"
},
"x-jws-signature-Param": {
"in": "header",
"name": "x-jws-signature",
"type": "string",
"required": false,
"description": "DO NOT USE. Header containing a detached JWS signature of the body of the payload."
},
"AccountRequestIdParam": {
"name": "AccountRequestId",
"in": "path",
"description": "Unique identification as assigned by the ASPSP to uniquely identify the account request resource.",
"required": true,
"type": "string"
}
},
"definitions": {
"OBReadRequest1": {
"type": "object",
"properties": {
"Data": {
"$ref": "#/definitions/OBReadData1"
},
"Risk": {
"$ref": "#/definitions/OBRisk2"
}
},
"required": [
"Data",
"Risk"
],
"additionalProperties": false
},
"OBReadData1": {
"type": "object",
"properties": {
"Permissions": {
"items": {
"$ref": "#/definitions/OBExternalPermissions1Code"
},
"type": "array",
"description": "Specifies the Open Banking account request types. This is a list of the data clusters being consented by the PSU, and requested for authorisation with the ASPSP.",
"minItems": 1
},
"ExpirationDateTime": {
"description": "Specified date and time the permissions will expire.\nIf this is not populated, the permissions will be open ended.\nAll dates in the JSON payloads are represented in ISO 8601 date-time format. \nAll date-time fields in responses must include the timezone. An example is below:\n2017-04-05T10:43:07+00:00",
"type": "string",
"format": "date-time"
},
"TransactionFromDateTime": {
"description": "Specified start date and time for the transaction query period.\nIf this is not populated, the start date will be open ended, and data will be returned from the earliest available transaction.\nAll dates in the JSON payloads are represented in ISO 8601 date-time format. \nAll date-time fields in responses must include the timezone. An example is below:\n2017-04-05T10:43:07+00:00",
"type": "string",
"format": "date-time"
},
"TransactionToDateTime": {
"description": "Specified end date and time for the transaction query period.\nIf this is not populated, the end date will be open ended, and data will be returned to the latest available transaction.\nAll dates in the JSON payloads are represented in ISO 8601 date-time format. \nAll date-time fields in responses must include the timezone. An example is below:\n2017-04-05T10:43:07+00:00",
"type": "string",
"format": "date-time"
}
},
"required": [
"Permissions"
],
"additionalProperties": false
},
"OBRisk2": {
"description": "The Risk section is sent by the initiating party to the ASPSP. It is used to specify additional details for risk scoring for Account Info.",
"type": "object",
"properties": {},
"additionalProperties": false
},
"OBReadResponse1": {
"type": "object",
"properties": {
"Data": {
"$ref": "#/definitions/OBReadDataResponse1"
},
"Risk": {
"$ref": "#/definitions/OBRisk2"
},
"Links": {
"$ref": "#/definitions/Links"
},
"Meta": {
"$ref": "#/definitions/Meta"
}
},
"required": [
"Data",
"Risk",
"Links",
"Meta"
],
"additionalProperties": false
},
"Links": {
"type": "object",
"description": "Links relevant to the payload",
"properties": {
"Self": {
"type": "string",
"format": "uri"
},
"First": {
"type": "string",
"format": "uri"
},
"Prev": {
"type": "string",
"format": "uri"
},
"Next": {
"type": "string",
"format": "uri"
},
"Last": {
"type": "string",
"format": "uri"
}
},
"additionalProperties": false,
"required": [
"Self"
]
},
"ISODateTime": {
"description": "All dates in the JSON payloads are represented in ISO 8601 date-time format. \nAll date-time fields in responses must include the timezone. An example is below:\n2017-04-05T10:43:07+00:00",
"type": "string",
"format": "date-time"
},
"Meta": {
"title": "MetaData",
"type": "object",
"description": "Meta Data relevant to the payload",
"properties": {
"TotalPages": {
"type": "integer",
"format": "int32"
},
"FirstAvailableDateTime": {
"$ref": "#/definitions/ISODateTime"
},
"LastAvailableDateTime": {
"$ref": "#/definitions/ISODateTime"
}
},
"additionalProperties": false
},
"OBReadDataResponse1": {
"allOf": [
{
"$ref": "#/definitions/OBReadData1"
},
{
"properties": {
"AccountRequestId": {
"description": "Unique identification as assigned to identify the account request resource.",
"type": "string",
"minLength": 1,
"maxLength": 128
},
"CreationDateTime": {
"description": "Date and time at which the resource was created.\nAll dates in the JSON payloads are represented in ISO 8601 date-time format. \nAll date-time fields in responses must include the timezone. An example is below:\n2017-04-05T10:43:07+00:00",
"type": "string",
"format": "date-time"
},
"Status": {
"$ref": "#/definitions/OBExternalRequestStatus1Code"
},
"StatusUpdateDateTime": {
"description": "Date and time at which the resource status was updated.\nAll dates in the JSON payloads are represented in ISO 8601 date-time format. \nAll date-time fields in responses must include the timezone. An example is below:\n2017-04-05T10:43:07+00:00",
"type": "string",
"format": "date-time"
}
}
},
{
"required": [
"AccountRequestId",
"CreationDateTime",
"Status",
"StatusUpdateDateTime"
]
}
]
},
"OBExternalRequestStatus1Code": {
"description": "Specifies the status of the account request resource.",
"type": "string",
"enum": [
"Authorised",
"AwaitingAuthorisation",
"Rejected",
"Revoked"
]
},
"OBExternalPermissions1Code": {
"description": "Specifies the Open Banking account request types. This is a list of the data clusters being consented by the PSU, and requested for authorisation with the ASPSP.",
"type": "string",
"enum": [
"ReadAccountsBasic",
"ReadAccountsDetail",
"ReadBalances",
"ReadBeneficiariesBasic",
"ReadBeneficiariesDetail",
"ReadDirectDebits",
"ReadOffers",
"ReadPAN",
"ReadParty",
"ReadPartyPSU",
"ReadProducts",
"ReadScheduledPaymentsBasic",
"ReadScheduledPaymentsDetail",
"ReadStandingOrdersBasic",
"ReadStandingOrdersDetail",
"ReadStatementsBasic",
"ReadStatementsDetail",
"ReadTransactionsBasic",
"ReadTransactionsCredits",
"ReadTransactionsDebits",
"ReadTransactionsDetail"
]
}
},
"responses": {
"201AccountRequestCreated": {
"description": "Account Request resource successfully created",
"schema": {
"$ref": "#/definitions/OBReadResponse1"
},
"headers": {
"x-jws-signature": {
"type": "string",
"description": "DO NOT USE. Header containing a detached JWS signature of the body of the payload."
},
"x-fapi-interaction-id": {
"type": "string",
"description": "An RFC4122 UID used as a correlation id."
}
}
},
"204AccountRequestDeleted": {
"description": "Account Request resource successfully deleted",
"headers": {
"x-fapi-interaction-id": {
"type": "string",
"description": "An RFC4122 UID used as a correlation id."
}
}
},
"400ErrorResponse": {
"description": "Bad Request"
},
"401ErrorResponse": {
"description": "Unauthorized"
},
"403ErrorResponse": {
"description": "Forbidden"
},
"405ErrorResponse": {
"description": "Method Not Allowed"
},
"406ErrorResponse": {
"description": "Not Acceptable"
},
"429ErrorResponse": {
"description": "Too Many Requests",
"headers": {
"Retry-After": {
"description": "Number in seconds to wait",
"type": "integer"
}
}
},
"500ErrorResponse": {
"description": "Internal Server Error"
},
"200AccountRequestRead": {
"description": "Account Request resource successfully retrieved",
"schema": {
"$ref": "#/definitions/OBReadResponse1"
},
"headers": {
"x-jws-signature": {
"type": "string",
"description": "DO NOT USE. Header containing a detached JWS signature of the body of the payload."
},
"x-fapi-interaction-id": {
"type": "string",
"description": "An RFC4122 UID used as a correlation id."
}
}
}
},
"securityDefinitions": {
"TPPOAuth2Security": {
"type": "oauth2",
"flow": "application",
"tokenUrl": "https://authserver.example/token",
"scopes": {
"accounts": "Ability to read Accounts information"
},
"description": "TPP client credential authorisation flow with the ASPSP"
}
}
}
Command line used for generation
java -jar swagger-codegen-cli-2.3.1.jar generate -i Account-request_CMA2_0_Swagger_json.json -l spring -o resultModel -DdateLibrary=java8
Steps to reproduce
java -jar swagger-codegen-cli-2.3.1.jar generate -i Account-request_CMA2_0_Swagger_json.json -l spring -o resultModel -DdateLibrary=java8
Follow the path :
- resultModel
-src
-main
-java
-io
-swagger
-model
-OBReadDataResponse1.java
Generated domain doesn't have fields "accountRequestId", "CreationDateTime", "Status", "StatusUpdateDateTime".
Related issues/PRs
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce generation with the supplied Swagger 2.0 declaration and inspect the generated OBReadDataResponse1.java model. Trace how the referenced OBReadDataResponse1 definition is processed; done when accountRequestId, CreationDateTime, Status, and StatusUpdateDateTime appear as generated fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100