BeyondCodeBootcamp / BeyondCodeBootcamp/jswithtypes.com

feature: /json-to-jsdoc

Open
#1 2 comments 0 reactions 0 assignees View on GitHub
good first issue hacktoberfest
Dominant language
JavaScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

# The Big Idea

I'd like to host a standalone online tool like https://transform.tools/json-to-jsdoc, but that will break down intermediary types, and also handle enums.

- [ ] JavaScript conversion function (no frameworks or libraries)
- `JSON.stringify(input, null, 2)` to prettify JSON
- Traverses JSON to produce JSDoc
- Checkbox for "treat arrays as enums"
- Order types alphabetically
- "" is type `String`
- "a|b|c" creates a typedef `MyTypeStatusEnum` ?
- [ ] HTML Textareas
- CSS with variables (see MVP.css)

## Example Output: JSON

```js
/** @typedef {object} json
* @property {object} about
* @property {string} about.legalBusinessName
* @property {string} about.website
* @property {string} about.industry
* @property {string} about.countryOfOperation
* @property {string} about.description
* @property {string} about.operations
*/
```

should instead be

```js
/**
* @typedef MyType
* @prop {MyTypeAbout} about
*/

/**
* @typedef MyTypeAbout
* @prop {String} legalBusinessName
* @prop {String} website
* @prop {String} industry
* @prop {String} countryOfOperation
* @prop {String} description
* @prop {String} operations
*/
```

## Example Output: Enums

Maybe any props that are all caps and assigned an array could be considered enums?

```js
/**
* @typedef {"IsPep"|"IsNotPep"} PepOption
*/
Mercury.POLITICALLY_EXPOSED_OPTIONS = ["IsPep", "IsNotPep"];
```

Contributor guide

No contributing guide indexed for this repository

Research direction

No files, tests, or entry points are named. Start by locating the standalone tool's JavaScript conversion code and HTML textarea UI, then compare the implementation with the requested intermediary types, enum handling, alphabetical ordering, and CSS variables; completion means the listed JSON and enum examples produce the intended JSDoc output.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html, javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.