OpenAPITools / OpenAPITools/openapi-generator

[Java] Error generating constructor in java

Open
#18,360 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Announcement
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

id("org.openapi.generator") version "7.4.0"

openapi: 3.0.1
info:
title: iT.eam SAW Core Users
description: Private APIs
version: 1.0.0

CreateUserAccountRequest: type: object required: - email - first_name - last_name properties: tenant_id: type: string description: | The TenantId which this account belongs to. example: cf2de83b-ac68-441b-bc54-21de60014d57 tenant_name: type: string description: | The TenantId which this account belongs to. example: cf2de83b-ac68-441b-bc54-21de60014d57 email: type: string description: | User's email address that will be used on the system. This can not be changed later. pattern: ^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$ maxLength: 80 example: joao.oliveira@example.com domain: type: string default: '' description: | Domain name password: type: string company: type: string description: | Company name first_name: type: string description: | User's first name maxLength: 20 minLength: 2 example: João middle_name: type: string description: | User's middle name(s) maxLength: 25 minLength: 2 example: da Silva last_name: type: string description: | User's last name maxLength: 20 minLength: 2 example: Oliveira mobile: type: string description: | User's mobile number. pattern: ^\+\d+ maxLength: 14 example: "+5531999990000" locale: type: string description: | Preferred language chosen by the User qradar_allowed_domain_ids: type: array items: type: string default: [ ] description: | List of Domains on QRadar which this Accout has access. Empty or null list will be considered as Full Access on all Domains on QRadar. example: [ "2", "4", "7" ] resilient_allowed_organization_names: type: array items: type: string default: [ ] description: | List of Organizations on Resilient which this Account has access. Empty or null list will be considered as Full Access on all Organizations on Resilient. siem_allowed_domain_ids: type: array nullable: true items: type: string default: [ ] description: | List of allowed domain ids soar_allowed_domain_names: type: array nullable: true items: type: string default: [ ] description: | List of allowed domain names vmdr_allowed_domain_ids: type: array nullable: true items: type: string default: [ ] description: | List of allowed Vmdr domain ids password_validity: $ref: '#/components/schemas/PasswordValidity' send_created_password: type: boolean default: false description: | Indicates whether the created password should be sent to the user user_agent: type: string provider_id: type: string provider_name: type: string

`public CreateUserAccountRequest qradarAllowedDomainIds(List qradarAllowedDomainIds) {

    this.qradarAllowedDomainIds = qradarAllowedDomainIds;
    return this;
    }

        public CreateUserAccountRequest addQradarAllowedDomainIdsItem(String qradarAllowedDomainIdsItem) {
                if (this.qradarAllowedDomainIds == null) {
                this.qradarAllowedDomainIds = new ArrayList<>();
                }
            this.qradarAllowedDomainIds.add(qradarAllowedDomainIdsItem);
            return this;
        }` 
        
      The error occurred after updating the version to 7.4, in version 6.1.0 the above error did not occur.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The payload does not name repository files or tests. Start by reproducing generation with the provided CreateUserAccountRequest schema on OpenAPI Generator 7.4.0 and compare it with 6.1.0, focusing on the generated Java model constructor and qradarAllowedDomainIds methods. Done means generation completes without the reported constructor error and the generated model is valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.