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

Add option to preserve schema case in id #209

Closed
DavidBiesack opened this issue Jan 8, 2019 · 5 comments
Closed

Add option to preserve schema case in id #209

DavidBiesack opened this issue Jan 8, 2019 · 5 comments

Comments

@DavidBiesack
Copy link
Contributor

widdershins normalizes each schema name to lowercase when generating ids. /components/schemas/abcDef results in

<h2 id="tocSabcdef">abcDef</h2>

<a id="schemaabcdef"></a>

Note: case is already preserved for operationId: operationId: createResource results in

## `createAccount`
<a id="opIdcreateAccount"></a>

Describe the solution you'd like

Add an option options.preserveSchemaCase. The default would be false, so as to not break existing deployments which have bookmarks in external doc to #schemaabcdef.

Preferable: add an _ or other character before the schema name, to id strings are more legible

<h2 id="tocS_abcDef">abcDef</h2>

<a id="schema_abcDef"></a>
@MikeRalphson
Copy link
Contributor

What benefit does this proposed change bring?

@DavidBiesack
Copy link
Contributor Author

We wish to link from other automatically generated content based on the OpenAPI definition (related tutorials, SDK doc, release notes, audit reports, etc) to shins output, and it is 1) inconvenient to have to transform identifiers and 2) yields links that are easier to read and therefore easier to visually verify. #schemaexternalaccounttransfer is much harder (for me, at least) to read/verify than #schema_externalAccountTransfer.

@ehallander9591
Copy link

I notice that the output examples don't accurately represent both attribute names, nor enum values. For example, depending on the language tab, but let's take javascript, proto_buf attribute some_field will generate openAPI some_field (swagger) gets turned into somefield in examples where generated javascript will be someField. Underscores preserved in enums are removed in examples. SOME_VALUE turns into SOMEVALUE.

In the same generated markdown file I have both:
'javascript--nodejs as json (Wrong)
"solvercriteriatype": "SCTNOTSPECIFIED",

and
Body parameter as json (Correct
sample.zip

)
"solver_criteria_type": "SCT_NOT_SPECIFIED"

I dropped a sample

@MikeRalphson
Copy link
Contributor

@ehallander9591 The language tab settings in your YAML front-matter look wrong:

---
title: davinci/service/route/grpc/Routing.proto
language_tabs:
  - '''go': Go'
  - '''javascript--nodejs': Node.JS'
  - '''http': HTTP'
  - '''javascript': JavaScript'
toc_footers: []
includes: []
search: false
highlight_theme: darkula
headingLevel: 2

---

There are extra single quotation marks which should not be there. Can you try removing them and see what happens?

@MikeRalphson
Copy link
Contributor

Should be fixed in version 4.0.0, which includes breaking changes (please see the README.md file).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants