Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support generic keywords #250

Closed
giovannicardamone-facile opened this issue Oct 20, 2022 · 3 comments
Closed

Support generic keywords #250

giovannicardamone-facile opened this issue Oct 20, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers question Further information is requested

Comments

@giovannicardamone-facile
Copy link

giovannicardamone-facile commented Oct 20, 2022

Support generic keywords

Description

JSON Schema allows to use into schema definition generic keywords (https://json-schema.org/understanding-json-schema/reference/generic.html?highlight=description)

for example:

  • title
  • description
  • examples
  • deprecated

and so on.

i was looking into

https://github.com/samchon/typescript-json/blob/c709379db511b13b334ae9d4abdc0923033a1797/src/programmers/internal/application_schema.ts#L21

and i noticed that none of the keywords above can be "injected" into the schema genearation using TSON.application.

as specified in

https://swagger.io/specification/#schema-object

the supported properties for the schema definition are an extended Subset of JSON Schema Draft 00

Feature Request

would be nice to have the capabilities to generate thoose props directly with the jsDoc interface, right now for example using @description the generated schema is the following

interface:

export interface User{
    /**
     * @description email
     */
    email: string
}

generated:

email: {
    type: 'string',
    nullable: false,
    jsDocTags: [
        {
            name: 'description',
            text: [ { text: 'email', kind: 'text' } ]
        }
    ]
}

instead should be generated in this way:

email: {
    type: 'string',
    nullable: false,
    description: "email"
}
@samchon
Copy link
Owner

samchon commented Oct 20, 2022

If you want to fill the description property, just write down the content without @ symbol like below:

interface Something {
    /**
      * This content would be placed into the `description` property.
      */
    email: string;
}

@samchon samchon self-assigned this Oct 20, 2022
@samchon samchon added enhancement New feature or request question Further information is requested labels Oct 20, 2022
@samchon
Copy link
Owner

samchon commented Oct 20, 2022

About other properties, I'll support them soon. Thanks for suggestion.

@samchon samchon added the good first issue Good for newcomers label Oct 20, 2022
@samchon
Copy link
Owner

samchon commented Nov 3, 2022

Update to 3.3.20, then you can meet your suggested features (except examples).

About the examples property, I haven't implemented it because expressing object example data as a descriptive comment is not possible.

@samchon samchon closed this as completed in a378c09 Nov 3, 2022
samchon added a commit that referenced this issue Nov 3, 2022
Close #250 - support more JSON schema properties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants