OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.3k stars 6.44k forks source link

[Clojure] Add more complex spec tests to run the generator on #743

Open f-f opened 6 years ago

f-f commented 6 years ago
Description

As we figured out in #122, the current Petstore spec is not enough to test all the edge cases of the generator.

Suggest a fix/enhancement

As @wing328 suggested in https://github.com/OpenAPITools/openapi-generator/pull/122#issuecomment-403228826, we should start testing on the fake petstore spec.

Rough list of things to do for this issue:

devth commented 4 years ago

I found an openapi spec that causes the Clojoure openapi-generator to generate invalid code.

Mattermost openapi.yaml

This generates invalild ns require statements like:

[mattermost-clj.specs. :refer :all]

e.g.

(ns mattermost-clj.specs.post-metadata-embeds
  (:require [clojure.spec.alpha :as s]
            [spec-tools.data-spec :as ds]
            [mattermost-clj.specs. :refer :all]
            )
  (:import (java.io File)))
devth commented 4 years ago

I think until spec generation is well-tested there should be a config option on the Clojure generator to disable specs.

For anyone using homebrew who wants to downgrade to a version that doesn't use specs:

brew uninstall openapi-generator

Install a pre-4.x version:

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/53d1f029cb5694a41640cff05a3791e5ffac37c6/Formula/openapi-generator.rb