Description
When using a generated client, serialization only looks at the referenced type when serializing properties of the object. If you are using inheritance, you will lose properties of the subclasses when you serialize.
Openapi-codegen version
3.0.0
Swagger declaration file content or url
swagger: "2.0"info:
version: "1.0.0"title: Price Lists Service# during dev, should point to your local machinehost: localhost:10010# basePath prefixes all resource paths basePath: /#schemes:
# tip: remove http to make production-grade
- http# format of bodies a client can send (Content-Type)consumes:
- application/json# format of the responses to the client (Accepts)produces:
- application/jsonpaths:
/pricelists/{priceListId}/pricepoints/{pricePointId}:
x-swagger-router-controller: pricePointsput:
description: Updates a price pointoperationId: updatePricePointparameters:
- name: priceListIdin: pathdescription: Unique id of the price list to retrieverequired: truetype: integerformat: int64minimum: 0
- name: pricePointIdin: pathdescription: Unique id of the price point to updaterequired: truetype: integerformat: int64minimum: 0
- name: pricePointin: bodydescription: Price point to updaterequired: trueschema:
$ref: "#/definitions/UpdatePricePointRequest"responses:
200:
description: Successschema:
$ref: "#/definitions/PricePoint"400:
description: Bad Requestschema:
$ref: "#/definitions/BadRequestResponse"404:
description: Not Foundschema:
$ref: "#/definitions/NotFoundResponse"409:
description: Conflictschema:
$ref: "#/definitions/ConflictResponse"default:
description: Errorschema:
$ref: "#/definitions/ErrorResponse"description: Deletes a price pointoperationId: deletePricePointparameters:
- name: priceListIdin: pathdescription: Unique id of the price listrequired: truetype: integerformat: int64minimum: 0
- name: pricePointIdin: pathdescription: Unique id of the price point to deleterequired: truetype: integerformat: int64minimum: 0responses:
204:
description: Successschema:
type: string400:
description: Bad Requestschema:
$ref: "#/definitions/BadRequestResponse"404:
description: Not Foundschema:
$ref: "#/definitions/NotFoundResponse"default:
description: Errorschema:
$ref: "#/definitions/ErrorResponse"/swagger:
x-swagger-pipe: swagger_raw# complex objects have schema definitionsdefinitions:
type: objectproperties:
restrictions:
$ref: "#/definitions/PricePointRestrictions"PricePointRestrictions:
type: arrayitems:
$ref: "#/definitions/PricePointRestriction"PricePointRestriction:
type: objectdiscriminator: restrictionTyperequired:
- restrictionTypeproperties:
restrictionType:
type: stringenum:
- EntityRestrictionEntityRestriction:
type: objectallOf:
- $ref: "#/definitions/PricePointRestriction"
- required:
- entityId
- entityTypeproperties:
entityId:
type: stringentityType:
type: stringformat: stringenum:
- skutype: objectrequired:
- entityId
- entityType
- priceproperties:
entityId:
type: stringentityType:
type: stringformat: stringenum:
- productprice:
type: numberformat: doubleminimum: 0.00PricePoint:
type: objectrequired:
- id
- entryId
- pricePointType
- restrictions
- priceproperties:
id:
type: integerformat: int64minimum: 0entryId:
type: integerformat: int64minimum: 0pricePointType:
type: stringformat: stringenum:
- addition
- overriderestrictions:
type: arrayitems:
$ref: "#/definitions/PricePointRestriction"price:
type: numberformat: doubleminimum: 0.00type: objectrequired:
- pricePointType
- restrictions
- priceproperties:
pricePointType:
type: stringformat: stringenum:
- addition
- overriderestrictions:
type: arrayminItems: 1items:
$ref: "#/definitions/PricePointRestriction"price:
type: numberformat: doubleminimum: 0.00UpdatePricePointRequest:
type: objectrequired:
- pricePointType
- restrictions
- priceproperties:
pricePointType:
type: stringformat: stringenum:
- addition
- overriderestrictions:
type: arrayminItems: 1items:
$ref: "#/definitions/PricePointRestriction"price:
type: numberformat: doubleminimum: 0.00BadRequestResponse:
type: objectrequired:
- errorCode
- messagesproperties:
errorCode:
type: stringexample: "400.5.2.0"messages:
type: arrayitems:
type: stringexample:
- Message here about why the request is invalid
- Another message here about why the request is invalidConflictResponse:
type: objectrequired:
- errorCode
- messagesproperties:
errorCode:
type: stringexample: "409.5.2.0"messages:
type: arrayitems:
type: stringexample:
- Name 'EntryType' is already in useErrorResponse:
type: objectrequired:
- errorCode
- messagesproperties:
errorCode:
type: stringexample: "500.5.2.0"messages:
type: arrayitems:
type: stringexample:
- "Something went wrong"NotFoundResponse:
type: objectrequired:
- errorCode
- messagesproperties:
errorCode:
type: stringexample: "404.5.2.0"messages:
type: arrayitems:
type: stringexample:
- Not FoundServiceUnavailableResponse:
type: objectrequired:
- errorCode
- messagesproperties:
errorCode:
type: stringexample: "503.5.2.0"messages:
type: arrayitems:
type: stringexample:
- Service is currently unavailableCommand line used for generation
java -jar .\openapi-generator-cli.jar generate -i /path/to/swagger.yaml -l typescript-node -o /path/to/target/directory
Steps to reproduce
With the generated code, run the following:
import{DefaultApi,UpdatePricePointRequest,PricePointRestriction,EntityRestriction}from"/path/to/target/directory";varapi:DefaultApi=newDefaultApi();varupdatePricePointRequest: UpdatePricePointRequest=newUpdatePricePointRequest();updatePricePointRequest.price=0updatePricePointRequest.pricePointType=UpdatePricePointRequest.PricePointTypeEnum.Override;updatePricePointRequest.restrictions=[{restrictionType: PricePointRestriction.RestrictionTypeEnum.EntityRestriction,entityId: 'Success',entityType: EntityRestriction.EntityTypeEnum.Sku}];api.updatePricePoint(0,0,updatePricePointRequest);If you step into the updatePricePoint call to where it goes to serialize the list of restrictions, you'll notice that entityId and entityType get left off the serialized object, so that when it is sent onto the server, it is invalid.
Description
When using a generated client, serialization only looks at the referenced type when serializing properties of the object. If you are using inheritance, you will lose properties of the subclasses when you serialize.
Openapi-codegen version
3.0.0
Swagger declaration file content or url
Command line used for generation
java -jar .\openapi-generator-cli.jar generate -i /path/to/swagger.yaml -l typescript-node -o /path/to/target/directory
Steps to reproduce
With the generated code, run the following:
If you step into the updatePricePoint call to where it goes to serialize the list of restrictions, you'll notice that entityId and entityType get left off the serialized object, so that when it is sent onto the server, it is invalid.