BRIKEV / express-jsdoc-swagger

Swagger OpenAPI 3.x generator
https://brikev.github.io/express-jsdoc-swagger-docs/#/
MIT License
218 stars 30 forks source link

feat: add support for dictionary primitives #227

Closed alexstaroselsky closed 2 years ago

alexstaroselsky commented 2 years ago

What kind of change does this PR introduce? (check at least one)

Description:

Add support for using primitive values with Dictionary special type. For example to represent object with any number of string keys and string values:

{
  "en": "English",
  "fr": "French"
}

Official documentation on dictionaries in OpenAPI: https://swagger.io/docs/specification/data-models/dictionaries/

While object is technically a primitive value based on TYPES in transforms/utils/validateTypes.js, users of this library will want to use typedef to represent objects.

For what it's worth, normally in JSDoc dictionary/record type objects are represented as:

Object.<string,string>
sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication