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

Title containing the 'error' word displays box with red text color #85

Open
zbodor-gs opened this issue Feb 6, 2020 · 0 comments
Open

Comments

@zbodor-gs
Copy link

zbodor-gs commented Feb 6, 2020

Hi,

if I combine schemas with e.g. a oneOf keyword, and these schemas have titles, docson displays these titles in the signature boxes instead of 'any', this is cool. But if the title contains multiple words and one of them happens to be the "error" word, then the text color of this title changes to red:

{
  "oneOf": [
    {
      "title": "Response of succeeded execution",
      "type": "object",
      "properties": {
        ...
      }
    },
    {
      "title": "Response of failed execution with error object",
      "type": "object",
      "properties": {
        ...
      }
    }
  ]
}

renders as
image

This is because of the way signature.html assigns classes to these boxes (... class="box-{{boxId}} signature-type-{{__type}} ...) and the way docson.js assigns value to the __type variable: ... schema.__type = schema.title; .... This results in the signature box having classes like: class="box-2 signature-type-Response of failed execution with error object .... And because of the whitespaces, 'error' is understood as separate class for the span, so docson.css colors it red.

This could be fixed e.g. by a custom handler which keeps only the first word for the signature-type- class, or by having two separate variables for these two purposes (class assignment and box content).

Zoli

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

No branches or pull requests

1 participant