RedHatInsights / insights-api-common-rails

Header, Encryption, RBAC, Serialization, Pagination and other common behavior for Insights microservices built with Rails
Apache License 2.0
3 stars 25 forks source link

The status field in the error object is string #188

Closed mkanoor closed 4 years ago

mkanoor commented 4 years ago

To conform with the IPP and the JSON API error object format the generator should be using string for status.

https://jsonapi.org/format/#errors

This PR updates the pre-canned type used by the generator used by topology and sources when they generate the openapi.json so it can create the JSON API conformant type.

https://github.com/RedHatInsights/sources-api/blob/8782d2103bed61c40b547603089c0978624950e1/public/doc/openapi-3-v3.0.json#L1780

mkanoor commented 4 years ago

@eclarizio The openapi generator doesn't have any specs, It runs thru app/models and generates an openapi.json for sources and topology. The changes in this PR is part of a precanned section that is inserted into the openapi.json file. This is only for documentation purposes when an error is sent out from the api-server we create an ErrorDcoument that conforms to this spec. It becomes part of the HTTP response body and at that point it doesn't matter if its a string or an integer.

We do have failures when we test the error response from a api request. They are handled separately in this PR https://github.com/RedHatInsights/sources-api/pull/219

There are tons of failure that is being fixed in that PR.

This PR just fixes the documentation aspect of it so that we dont keep inserting the precanned object with integer status.