openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[BUG][Clojure] --name-mappings is not applied to property names

Open valpackett opened this issue 1 year ago • 0 comments

Description

The Clojure generator does not apply --name-mappings.

openapi-generator version

0e05cf26d94

OpenAPI declaration file content or url
openapi: '3.0.0'
info:
  version: 1.0.0
  title: test
paths:
  /test:
    get:
      summary: sample
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  _:
                    type: string
Generation Details
java -jar /home/val/.m2/repository/org/openapitools/openapi-generator-cli/7.6.0-SNAPSHOT/openapi-generator-cli-7.6.0-SNAPSHOT.jar generate -i spec.yaml -o clj/ -g clojure --name-mappings _=underscore
Steps to reproduce

generate, see this:

(def -test-get-200-response-data
  {
   (ds/opt :_) string?
   })

(def -test-get-200-response-spec
  (ds/spec
    {:name ::-test-get-200-response
     :spec -test-get-200-response-data}))

(in Clojure's case the underscore, and even the emptiness where it gets turned into nothing, is actually valid code, but still, remapping might be required for other reasons)

Related issues/PRs

e.g. #18663 for Dart

Suggest a fix

valpackett avatar May 14 '24 05:05 valpackett