herbsjs / herbsshelf

Dynamically generated documentation for your domain
Other
8 stars 16 forks source link

Usecase response is weird when usecase has no request #57

Closed vitorgamer58 closed 1 year ago

vitorgamer58 commented 1 year ago

Describe the bug In some cases, a usecase does not have a request, that is, it does not receive any value, but it returns values. When this happens, HerbsShelf appears to have no rules for dealing with these types of usecases, which causes it to display the response in a strange way, adding an ´Object of´ that it does not add when there is a request.

  usecase("Buscar fechamento do dia", {
    request: {},

    response: {
      maioresAltas: [Stock],
      maioresBaixas: [Stock],
      maisNegociadas: [Stock],
      deltaIbov: Number,
      dataAtual: String,
    },

To Reproduce Steps to reproduce the behavior:

In any herbsjs project, create a usecase that has request {} and that has any field as response, then open the HerbsShelf.

Expected behavior I believe that the expected behavior is that it displays the response just like any other usecase that has request.

Screenshots Behavior in HerbsShelf 5.0.1 herbsshelf5.0.1

Behavior in HerbsShelf 5.1.0-beta.5 herbsshelfbeta

Expected Behavior Normal Response

Additional context Using herbarium 1.4.0, herbs 2.0.0 and gotu 1.2.0

vitorgamer58 commented 1 year ago

The non-display of the entity type maioresAltas which is an Array of Stock, may be related to the issue https://github.com/herbsjs/herbs2mermaid/issues/6