Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputStream - cannot find symbol #1223

Closed
oliverblaha opened this issue Sep 26, 2023 · 0 comments · Fixed by #1225
Closed

InputStream - cannot find symbol #1223

oliverblaha opened this issue Sep 26, 2023 · 0 comments · Fixed by #1225

Comments

@oliverblaha
Copy link

Expected Behavior

The correct import for InputStream (java.io.InputStream) should be generated when building a client.

Actual Behaviour

An import for InputStream below the generated model is added, which causes compilation to fail.
I followed the OpenAP client guide, but replaced the OpenAPI definition by another one (which is provided to me by a third party, therefore I'd prefer not to have to have to modify it for maintainability reasons). Example below.

Note: I'm only building a client, I don't know if this affects server building, too.

Steps To Reproduce

  1. Follow : https://guides.micronaut.io/latest/micronaut-openapi-generator-client-gradle-java.html
  2. Replace the OpenAPI definition with this one:
---
openapi: "3.0.3"
info:
  version: "v1"
  title: "Dummy"
paths:
  /assets:export:
    get:
      operationId: "Dummy"
      description: ""
      parameters:
        - name: "query"
          in: "query"
          description: ""
          required: false
          schema:
            type: "string"
      responses:
        "200":
          description: ""
          content:
            '*/*':
              schema:
                type: "string"
                format: "binary"
  1. Build it.
  2. Observe that the generated DefaultApi contains an invalid import of InputStream (import example.openmeteo.model.InputStream):
/*
 * Dummy
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v1
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
package example.openmeteo.api;

import io.micronaut.http.annotation.*;
import io.micronaut.core.annotation.*;
import io.micronaut.http.client.annotation.Client;
import io.micronaut.core.convert.format.Format;
import example.openmeteo.model.InputStream;
import jakarta.annotation.Generated;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Generated(value = "io.micronaut.openapi.generator.JavaMicronautClientCodegen")
@Client("${openapi-micronaut-client-base-path}")
public interface DefaultApi {

    /**
     *
     *
     * @param query  (optional)
     *
     * @return InputStream
     */
    @Get("/assets:export")
    InputStream dummy(
        @QueryValue(value = "query") @Nullable String query
    );
}

Environment Information

  • Operating System: Ubuntu Linux
  • JDK Version: Tested with 11 and 17
  • Micronaut (plugin) version: Tested with 4.0.3 and 4.1.1

Example Application

No response

Version

4.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant