Closed
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?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
The problem occurred when dart-dio was generated using the OpenAPI 3.1.0 version of the definition file.
The reason is that when creating a GET API using the [Query / PATH] parameter, the import of the dependent class is no longer generated (JsonObject: built_value/json_object.dart).
In OpenAPI 3.0.3, there was no problem because the type of the target parameter is a primitive type. (ex. String)
openapi-generator version
{
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "6.6.0"
}
}
In addition to the above, similar problems occurred in 6.5.0 and 7.0.0-beta.
OpenAPI declaration file content or url
openapi: 3.1.0
info:
title: test
version: '1.0'
paths:
/users:
parameters: []
get:
tags: []
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/User'
examples:
Get User Alice Smith:
value:
id: 142
firstName: Alice
operationId: get-userId
description: Retrieve the information of the user with the matching user ID.
parameters:
- $ref: '#/components/parameters/userId'
components:
schemas:
User:
title: User
type: object
description: ''
examples:
- id: 142
firstName: Alice
properties:
id:
type: integer
description: Unique identifier for the given user.
firstName:
type: string
required:
- id
- firstName
parameters:
userId:
name: userId
in: query
required: false
schema:
type: string
Generation Details
Steps to reproduce
- Create the yaml or json shown in the example using Stoplight Studio
- Run generate with the latest Docker container shown officially
- Checking the contents of the generated file, import is missing (/lib/src/api/default_api.dart)
Related issues/PRs
I could not find an Issue that is exactly the same.
Suggest a fix
I don't know why this is, but the file is generated without importing built_value/json_object.dart, causing a compile error.