ebowman / api-first-hand

API-First bootstrapping tool for building RESTful web services from a Swagger/OpenAPI spec
MIT License
142 stars 22 forks source link

is it possible to return a generic JSON? (no schema in swagger) #88

Open seralf opened 6 years ago

seralf commented 6 years ago

Hi I'm trying to develop a component which exposes its own API as defined in the swagger model, but for a couple of endpoints has to call an external service, and expose directly the results from it, acting as a sort of proxy.

Is it that possible using the api-first-hand plugin? I mean: I expected to be able to use a definition similar to the following one:

"/items": 

    get: 
      operationId: "listOfItems"
      produces: 
        - "application/json"
      responses: 
        200:
          schema:
            type: object

But it will produce a case class ItemsGetResponses200() "empty" (no fields). Using AnyValue, object or {} object schema, I always get the same behaviour.

Is there maybe a default model I could use here? I'm fine declaring models first, but for this case only I really can't: I have to put the data in the response as they were from the external service, and still declare at least the endpoint and its parameters for swagger.

Does anybody has any idea on how to accomplish that? tanks in advance

Alfredo