openapi-processor / openapi-processor-spring

an OpenAPI 3.0 & 3.1 interface & model java code generator for Spring Boot
https://docs.openapiprocessor.io
Apache License 2.0
40 stars 9 forks source link

Type Mapping with format not working #119

Closed schlagi123 closed 4 years ago

schlagi123 commented 4 years ago

Hi,

here my mapping.yaml and opanapi.yaml

openapi-processor-mapping: v2

options:
  package-name: de.vwn.inbound.smartdcm.api.generated

map:
  types:
    - type: array => java.util.List
    - type: string:binary => org.springframework.web.multipart.MultipartFile
openapi: 3.0.2

info:
  title: Service
  description: API
  version: 1.0.0

paths:
  /download:
    get:
      summary: download an avatar
      operationId: get_avatar
      tags:
        - user
      parameters:
        - in: query
          name: test
          schema:
            type: array
            items:
              type: string
      responses:
        200:
          description: user avatar
          content:
            application/*:
              schema:
                type: string
                format: binary

The result is the following Interface:

public interface UserApi {
    @GetMapping(path = "/upload", produces = {"application/*"})
    MultipartFile getAvatar(@RequestParam(name = "test", required = false) List<MultipartFile> test);
}

spring processor version: 1.0.0.M19 gradle plugin version: 1.0.0.M8

The mapping of the return type is correct, but the mapping of the parameter is wrong. List was expected by me.

hauner commented 4 years ago

Hmm, it is a list, i guess you mean List<String> instead of List<MultipartFile>?

Looks like it is considering the string:binary mapping. That is unexpected.. ;-)

hauner commented 4 years ago

interesting is that it is broken even without the array mapping.

hauner commented 4 years ago

the bug is that matching the mapping does not honor the format in all cases