Skip to content

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

@zbodor-gs

Description

@zbodor-gs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions