You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
addItem can use wrong class in the call of allOf.
openapi-generator version
7.10.0, regression from 7.9.0
OpenAPI declaration file content or url
openapi: "3.0.0"info:
version: 1.0.0title: Swagger Petstorelicense:
name: MITservers:
- url: http://petstore.swagger.io/v1paths:
/pets:
get:
summary: List all petsoperationId: listPetstags:
- petsparameters:
- name: limitin: querydescription: How many items to return at one time (max 100)required: falseschema:
type: integerformat: int32responses:
200:
description: An paged array of petsheaders:
x-next:
description: A link to the next page of responsesschema:
type: stringcontent:
application/json:
schema:
$ref: "#/components/schemas/PetCollections"default:
description: unexpected errorcontent:
application/json:
schema:
$ref: "#/components/schemas/Error"post:
summary: Create a petoperationId: createPetstags:
- petsresponses:
201:
description: Null responsedefault:
description: unexpected errorcontent:
application/json:
schema:
$ref: "#/components/schemas/Error"/pets/{petId}:
get:
summary: Info for a specific petoperationId: showPetByIdtags:
- petsparameters:
- name: petIdin: pathrequired: truedescription: The id of the pet to retrieveschema:
type: stringresponses:
200:
description: Expected response to a valid requestcontent:
application/json:
schema:
$ref: "#/components/schemas/Pet"default:
description: unexpected errorcontent:
application/json:
schema:
$ref: "#/components/schemas/Error"components:
schemas:
Pet:
type: objectrequired:
- id
- nameproperties:
id:
type: integerformat: int64name:
type: stringtag:
type: stringHappyPet:
allOf:
- $ref: '#/components/schemas/Pet'description: |- A Happy Pet. It has all the same things as a regular Pet. Why is this an object instead of just a Pet? Well, there's reasons. Probably bad ones. But reasons.Pets:
type: arrayitems:
$ref: "#/components/schemas/Pet"HappyPets:
type: arrayitems:
$ref: "#/components/schemas/HappyPet"PetCollections:
type: objectproperties:
happyPets:
$ref: "#/components/schemas/HappyPets"Error:
required:
- code
- messageproperties:
code:
type: integerformat: int32message:
type: string
Generation Details
package com.ehi.rental.booking.reservation.api.model;
import java.net.URI;
import java.util.Objects;
import com.ehi.rental.booking.reservation.api.model.PetDto;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.io.Serializable;
import java.time.OffsetDateTime;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import java.util.*;
import jakarta.annotation.Generated;
/**
* PetCollectionsDto
*/
@JsonTypeName("PetCollections")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2024-12-13T15:33:07.204092900-06:00[America/Chicago]", comments = "Generator version: 7.10.0")
public class PetCollections implements Serializable {
private static final long serialVersionUID = 1L;
@Valid
private List<HappyPetDto> happyPets;
public PetCollectionsDto happyPets(List<HappyPetDto> happyPets) {
this.happyPets = happyPets;
return this;
}
public PetCollectionsDto addHappyPetsItem(PetDto happyPetsItem) {
if (this.happyPets == null) {
this.happyPets = new ArrayList<>();
}
this.happyPets.add(happyPetsItem);
return this;
}
/**
* Get happyPets
* @return happyPets
*/
@Valid
@JsonProperty("happyPets")
public List<HappyPetDto> getHappyPets() {
return happyPets;
}
public void setHappyPets(List<HappyPetDto> happyPets) {
this.happyPets = happyPets;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PetCollectionsDto petCollections = (PetCollectionsDto) o;
return Objects.equals(this.happyPets, petCollections.happyPets);
}
@Override
public int hashCode() {
return Objects.hash(happyPets);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class PetCollectionsDto {\n");
sb.append(" happyPets: ").append(toIndentedString(happyPets)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
addHappyPetsItem takes in the wrong class as a parameter. (PetDto instead of HappyPetDto)
Steps to reproduce
Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered:
Bug Report Checklist
Description
addItem can use wrong class in the call of allOf.
openapi-generator version
7.10.0, regression from 7.9.0
OpenAPI declaration file content or url
Generation Details
addHappyPetsItem takes in the wrong class as a parameter. (PetDto instead of HappyPetDto)
Steps to reproduce
Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered: