oliyh / martian

The HTTP abstraction library for Clojure/script, supporting OpenAPI, Swagger, Schema, re-frame and more
MIT License
529 stars 44 forks source link

Endpoint with content type of application/yaml does not seem to be supported #186

Closed mmeroberts closed 1 year ago

mmeroberts commented 1 year ago

With an OpenAPI spec that contains the following in the response section. The explore does not detect the application/yaml Accept type.

     responses:
        '200':
          description: OK
          content:
            application/yaml:
              schema:
               type: string

Output from martian/explore when using application/yaml:

{:summary "Retrieve a object",
 :parameters
 {:object-name java.lang.String,
  {:k :effective} (default Bool false)},
 :returns
 {200 nil,
  400
  {{:k :url} java.lang.String,
   :localizedMessage java.lang.String,
   {:k :details} {}},
  404
  {{:k :url} java.lang.String,
   :localizedMessage java.lang.String,
   {:k :details} {}},
  nil
  {{:k :url} java.lang.String,
   :localizedMessage java.lang.String,
   {:k :details} {}}}}

Notice the nil after the 200.

When setting the content to application/json the output is:

{:summary "Retrieve a object",
 :parameters
 {:object-name java.lang.String,
  {:k :effective} (default Bool false)},
 :returns
 {200 java.lang.String,
  400
  {{:k :url} java.lang.String,
   :localizedMessage java.lang.String,
   {:k :details} {}},
  404
  {{:k :url} java.lang.String,
   :localizedMessage java.lang.String,
   {:k :details} {}},
  nil
  {{:k :url} java.lang.String,
   :localizedMessage java.lang.String,
   {:k :details} {}}}}
mmeroberts commented 1 year ago

I see in the Readme there is an option to add your own encoder so I will close this.