stoplightio / json-schema-viewer

A JSON Schema viewer React component
Apache License 2.0
175 stars 37 forks source link

fix: choice naming #154

Closed marcelltoth closed 3 years ago

marcelltoth commented 3 years ago

Resolves @philsturgeon 's issues mentioned at https://stoplight-internal.slack.com/archives/C01D80M6EHX/p1624548332462800

philsturgeon commented 3 years ago

Ah ok cool. Yeah that’s fine.

-- Phil Sturgeon Product @ Stoplight.io

On Jun 24, 2021, at 17:30, Marcell Toth @.***> wrote:

 @marcelltoth commented on this pull request.

In src/components/SchemaRow/useChoices.ts:

@@ -12,12 +12,11 @@ type Choice = { };

function calculateChoiceTitle(node: SchemaNode, isPlural: boolean): string {

  • const complexObjectSuffix = isPlural ? '-s' : ''; const primitiveSuffix = isPlural ? 's' : ''; That second one does work AFAICT. It's for primitives, I tried them all, they all luckily work. objects, integers, booleans, nulls, strings.

I believe it feels much more natural to have that pluralization there, but LMK if you can reproduce a broken one.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.