SmartBear-DevRel / explore-cli

Simple utility CLI for importing and exporting data to and from SwaggerHub Explore
https://www.nuget.org/packages/Explore.Cli
Apache License 2.0
5 stars 4 forks source link

fix: issue #33 postman request descriptions are strings #34

Closed YOU54F closed 2 months ago

frankkilcommins commented 2 months ago

A collection description has a oneOf structure based on the following schema:


   "description":{
      "$schema":"http://json-schema.org/draft-07/schema#",
      "$id":"#/definitions/description",
      "description":"A Description can be a raw text, or be an object, which holds the description along with its format.",
      "oneOf":[
         {
            "type":"object",
            "title":"Description",
            "properties":{
               "content":{
                  "type":"string",
                  "description":"The content of the description goes here, as a raw string."
               },
               "type":{
                  "type":"string",
                  "description":"Holds the mime type of the raw description content. E.g: 'text/markdown' or 'text/html'.\nThe type is used to correctly render the description when generating documentation, or in the Postman app."
               },
               "version":{
                  "description":"Description can have versions associated with it, which should be put in this property."
               }
            }
         },
         {
            "type":"string"
         },
         {
            "type":"null"
         }
      ]
   }

We should deal with the possible options

YOU54F commented 2 months ago

I don't believe we are using the parsed value anyway, so we could remove it from attempting to parse completely

Do we have anywhere we can use the description in explore?

If we did, we would want to consider what we can support. Will wherever the field is displayed, does it need truncating? can it support alternate content types? do we want to?

frankkilcommins commented 2 months ago

It might depend on if we continue using the flat structure or if we allow nesting (preferred) and have multiple request per API "folder".

We could use the API "description" like at: https://github.com/SmartBear-DevRel/explore-cli/blob/main/src/Explore.Cli/Program.cs#L385

YOU54F commented 2 months ago

We could use the API "description" like at:

good suggestion, implemented

We should deal with the possible options

done, Description.Content, will now contain the value of description if it is a json string, otherwise it will be set to description.content if it exists.

Description.Type / Description.Version may also exist, and Description may be null

The Description.Content value is now used for the description of each uploaded item, and viewable from the UI. I've newline separated the time stamp below