OpenAPITools / OpenAPITools/openapi-generator

[BUG] dart-dio does not generate object properties as specified in the schema

Open
#15,372 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
Description

Does not generate object properties as specified in the schema

openapi-generator version

6.5.0

OpenAPI declaration file content or url
openapi: 3.0.1
info:
  title: backend
  description: backend
  contact:
    name: knobo
    url: https://localhost
    email: a@b.com
  license:
    name: Knobo 0.1
    url: https://localhost
  version: 0.0.1
servers:
- url: https://localhost
  description: Production
- url: http://localhost:8080
  description: Development
tags:
- name: Queue
paths:
  /api/queue/create:
    post:
      tags:
      - Queue
      summary: Create queue
      description: Create a queue
      operationId: createQueue
      requestBody:
        content:
          application/json:
            schema:
              required:
              - createQueueRequest
              type: object
              properties:
                createQueueRequest:
                  $ref: '#/components/schemas/CreateQueueRequest'
        required: true
      responses:
        "200":
          description: createQueue 200 response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueueDTO'
components:
  schemas:
    CreateQueueRequest:
      required:
      - description
      - name
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        organization:
          type: integer
          format: int64
          nullable: true
    QueueDTO:
      required:
      - current
      - description
      - last
      - title
      type: object
      properties:
        uuid:
          type: string
          format: uuid
          nullable: true
        title:
          type: string
        description:
          type: string
        createdBy:
          nullable: true
        current:
          type: integer
          format: int32
        last:
          type: integer
          format: int32
Generation Details

Should have produced name and descriptio for the CreateQueueRequest class.
But it does not.

/// CreateQueueRequest
///
/// Properties:
/// * [createQueueRequest] 
@BuiltValue()
abstract class CreateQueueRequest implements Built<CreateQueueRequest, CreateQueueRequestBuilder> {
  @BuiltValueField(wireName: r'createQueueRequest')
  CreateQueueRequest get createQueueRequest;

  CreateQueueRequest._();

  factory CreateQueueRequest([void updates(CreateQueueRequestBuilder b)]) = _$CreateQueueRequest;

  @BuiltValueHook(initializeBuilder: true)
  static void _defaults(CreateQueueRequestBuilder b) => b;

  @BuiltValueSerializer(custom: true)
  static Serializer<CreateQueueRequest> get serializer => _$CreateQueueRequestSerializer();
}

Steps to reproduce
openapi-generator-cli generate -i ./file.yaml  -g dart-dio -o queue

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

Start by running the supplied OpenAPI YAML with the openapi-generator-cli generate command and inspect the dart-dio generator entry points and templates. Compare the generated CreateQueueRequest class with the schema; done means its name and description properties are generated as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.