<commit_before>mixin readWriteJsonConstraint(property)
  if property.readOnly
    .badge.badge-rw ReadOnly
  if property.writeOnly
    .badge.badge.rw WriteOnly

mixin uniqueJsonConstraint(property)
  if property.unique
    .badge.badge-unique Unique

mixin patternJsonConstraint(property)
  if property.pattern
    .badge.badge-constraint
      code.pattern /#{property.pattern}/

mixin formatJsonConstraint(property)
  if property.format == 'date-time'
    .badge.badge-constraint
      a(href='http://en.wikipedia.org/wiki/ISO_8601') ISO-8601 date
  else if property.format == 'uri'
    .badge.badge-constraint URI

mixin minMaxJsonConstraint(property)
  if property.minimum || property.maximum
    if property.minimum !== undefined || property.maximum !== undefined
      - var exclusiveMinimum = property.exclusiveMinimum ? '<' : '<=';
      - var exclusiveMaximum = property.exclusiveMaximum ? '<' : '<=';

      if property.minimum === property.maximum
        .badge.badge-constraint == #{property.minimum}

      else if property.minimum !== undefined && property.maximum !== undefined
        .badge.badge-constraint #{property.minimum} #{exclusiveMinimum} value #{exclusiveMaximum} #{property.maximum}

      else if property.minimum !== undefined
        .badge.badge-constraint #{exclusiveMinimum.replace('<', '>')} #{property.minimum}

      else
        .badge.badge-constraint #{exclusiveMaximum} #{property.maximum}

mixin minMaxItemsJsonConstraint(property)
  if property.minItems || property.maxItems
    if property.minItems && property.maxItems
      if property.minItems === 1
        .badge.badge-constraint Exactly #{property.minItems} #{'item' + property.minItems > 1 ? 's' : ''}

      else if property.minItems
        .badge.badge-constraint At least #{property.minItems} #{'item' + property.minItems > 1 ? 's' : ''}

      else if property.maxItems
        .badge.badge-constraint At most #{property.minItems} #{'item' + property.minItems > 1 ? 's' : ''}

mixin minMaxLengthJsonConstraint(property)
  if property.minLength && property.maxLength
    if property.minLength === property.maxLength
      .badge.badge-constraint #{property.minLength} #{'char' + property.minLength > 1 ? 's' : ''}

    else if property.minLength && property.maxLength
      .badge.badge-constraint #{property.minLength} <= length <= #{property.maxLength}

    else if property.minLength
      .badge.badge-constraint At least #{property.minLength} #{'char' + property.minLength > 1 ? 's' : ''}

    else
      .badge.badge-constraint At most #{property.maxLength} #{'char' + property.maxLength > 1 ? 's' : ''}


mixin enumJsonConstraint(property)
  if property.enum
    if property.enum.length === 1
      .badge.badge-constraint == #{property.enum[0]}
    else
      .badge.badge-constraint One of:
        each value, i in property.enum
          code= value

mixin jsonSchemaConstraints(property, name, required)
  if required && required.indexOf(name) > -1
    .badge.badge-required Required

  +readWriteJsonConstraint(property)
  +uniqueJsonConstraint(property)
  +patternJsonConstraint(property)
  +formatJsonConstraint(property)
  +minMaxJsonConstraint(property)
  +minMaxLengthJsonConstraint(property)
  +enumJsonConstraint(property)
  +minMaxItemsJsonConstraint(property)

mixin propertyRowLeveled(property, level)
  if property.type == 'object'
    +properties(property, level + 1)
  else if property.type == 'array'
    +propertyRow(null, property.items, [], level + 1)

mixin propertyRowContent(name, property, required, level)
  .flex-table-row(class='level-#{level}')
    if name
      .flex-table-cell.s2.property= name
    else
      .flex-table-cell.s2.property
        .badge #{property.type == 'array' ? 'collection' : 'item'}
    .flex-table-cell.center
      if property.enum
        | enum[#{property.type ? property.type : '?'}]
      else
        = property.type
    .flex-table-cell.s2.constraints
      +jsonSchemaConstraints(property, name, required)
    .flex-table-cell.s4!= helpers.marked(property.description)
<commit_msg>Fixed when items is missing in property for array type<commit_after>mixin readWriteJsonConstraint(property)
  if property.readOnly
    .badge.badge-rw ReadOnly
  if property.writeOnly
    .badge.badge.rw WriteOnly

mixin uniqueJsonConstraint(property)
  if property.unique
    .badge.badge-unique Unique

mixin patternJsonConstraint(property)
  if property.pattern
    .badge.badge-constraint
      code.pattern /#{property.pattern}/

mixin formatJsonConstraint(property)
  if property.format == 'date-time'
    .badge.badge-constraint
      a(href='http://en.wikipedia.org/wiki/ISO_8601') ISO-8601 date
  else if property.format == 'uri'
    .badge.badge-constraint URI

mixin minMaxJsonConstraint(property)
  if property.minimum || property.maximum
    if property.minimum !== undefined || property.maximum !== undefined
      - var exclusiveMinimum = property.exclusiveMinimum ? '<' : '<=';
      - var exclusiveMaximum = property.exclusiveMaximum ? '<' : '<=';

      if property.minimum === property.maximum
        .badge.badge-constraint == #{property.minimum}

      else if property.minimum !== undefined && property.maximum !== undefined
        .badge.badge-constraint #{property.minimum} #{exclusiveMinimum} value #{exclusiveMaximum} #{property.maximum}

      else if property.minimum !== undefined
        .badge.badge-constraint #{exclusiveMinimum.replace('<', '>')} #{property.minimum}

      else
        .badge.badge-constraint #{exclusiveMaximum} #{property.maximum}

mixin minMaxItemsJsonConstraint(property)
  if property.minItems || property.maxItems
    if property.minItems && property.maxItems
      if property.minItems === 1
        .badge.badge-constraint Exactly #{property.minItems} #{'item' + property.minItems > 1 ? 's' : ''}

      else if property.minItems
        .badge.badge-constraint At least #{property.minItems} #{'item' + property.minItems > 1 ? 's' : ''}

      else if property.maxItems
        .badge.badge-constraint At most #{property.minItems} #{'item' + property.minItems > 1 ? 's' : ''}

mixin minMaxLengthJsonConstraint(property)
  if property.minLength && property.maxLength
    if property.minLength === property.maxLength
      .badge.badge-constraint #{property.minLength} #{'char' + property.minLength > 1 ? 's' : ''}

    else if property.minLength && property.maxLength
      .badge.badge-constraint #{property.minLength} <= length <= #{property.maxLength}

    else if property.minLength
      .badge.badge-constraint At least #{property.minLength} #{'char' + property.minLength > 1 ? 's' : ''}

    else
      .badge.badge-constraint At most #{property.maxLength} #{'char' + property.maxLength > 1 ? 's' : ''}


mixin enumJsonConstraint(property)
  if property.enum
    if property.enum.length === 1
      .badge.badge-constraint == #{property.enum[0]}
    else
      .badge.badge-constraint One of:
        each value, i in property.enum
          code= value

mixin jsonSchemaConstraints(property, name, required)
  if required && required.indexOf(name) > -1
    .badge.badge-required Required

  +readWriteJsonConstraint(property)
  +uniqueJsonConstraint(property)
  +patternJsonConstraint(property)
  +formatJsonConstraint(property)
  +minMaxJsonConstraint(property)
  +minMaxLengthJsonConstraint(property)
  +enumJsonConstraint(property)
  +minMaxItemsJsonConstraint(property)

mixin propertyRowLeveled(property, level)
  if property.type == 'object'
    +properties(property, level + 1)
  else if property.type == 'array' && property.items
    +propertyRow(null, property.items, [], level + 1)

mixin propertyRowContent(name, property, required, level)
  .flex-table-row(class='level-#{level}')
    if name
      .flex-table-cell.s2.property= name
    else
      .flex-table-cell.s2.property
        .badge #{property.type == 'array' ? 'collection' : 'item'}
    .flex-table-cell.center
      if property.enum
        | enum[#{property.type ? property.type : '?'}]
      else
        = property.type
    .flex-table-cell.s2.constraints
      +jsonSchemaConstraints(property, name, required)
    .flex-table-cell.s4!= helpers.marked(property.description)

{'fraction_non_alphanumeric': 0.129690746852463, 'fraction_numerical': 0.005867253392005867, 'mean_word_length': 3.6043894203714126, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2962194', 'n_tokens_mistral': 2506, 'n_tokens_neox': 2411, 'n_words': 508}