<commit_before># Imaginary API of a GitHub knockoff

exports.media_type = media_type = (name) ->
  "application/vnd.gh-knockoff.#{name}+json;version=1.0"

exports.schema =
  id: "gh-knockoff"
  properties:

    resource:
      type: "object"
      properties:
        url:
          type: "string"
          format: "uri"

    organization:
      extends: {$ref: "#resource"}
      mediaType: media_type("organization")
      properties:
        name: {type: "string"}
        plan: {$ref: "#plan"}
        projects:
          # Here's how you describe a dictionary
          type: "object"
          additionalProperties: {$ref: "#project"}
        members: {$ref: "#user_list"}

    organization_list:
      type: "object"
      mediaType: media_type("organization_list")
      additionalProperties: {$ref: "#organization"}


    plan:
      extends: {$ref: "#resource"}
      mediaType: media_type("plan")
      properties:
        name: {type: "string"}
        space: {type: "integer"}
        bandwidth: {type: "integer"}

    plan_list:
      type: "object"
      mediaType: media_type("plan_list")
      additionalProperties: {$ref: "#plan"}

    user:
      extends: {$ref: "#resource"}
      mediaType: media_type("user")
      properties:
        name: {type: "string"}
        email: {type: "string"}

    user_list:
      mediaType: media_type("user_list")
      type: "array"
      items: {$ref: "#user"}


    project:
      extends: {$ref: "#resource"}
      mediaType: media_type("project")
      properties:
        name: {type: "string"}
        description: {type: "string"}
        refs:
          type: "object"
          properties:
            main: {$ref: "#branch"}
            branches:
              type: "object"
              additionalProperties: {$ref: "#branch"}
            tags:
              type: "array"
              items: {$ref: "#tag"}

    project_list:
      mediaType: media_type("project_list")
      type: "array"
      items: {$ref: "#project"}


    reference:
      extends: {$ref: "#resource"}
      mediaType: media_type("reference")
      properties:
        name: {type: "string"}
        commit: {type: "string"}
        message: {type: "string"}

    branch:
      extends: {$ref: "#reference"}
      mediaType: media_type("branch")

    tag:
      extends: {$ref: "#reference"}
      mediaType: media_type("tag")



exports.resources =

  organizations:
    actions:

      create:
        method: "POST"
        request_schema: "organization"
        response_schema: "organization"
        status: 201

      search:
        method: "GET"
        response_schema: "organization_list"
        query:
          q:
            required: true
            type: "string"
          limit:
            type: "integer"
          offset:
            type: "integer"
        status: 200

  organization:
    actions:
      get:
        method: "GET"
        response_schema: "organization"
        status: 200

      update:
        method: "PUT"
        request_schema: "organization"
        response_schema: "organization"
        authorization: "Basic"
        status: 200

      delete:
        method: "DELETE"
        authorization: "Basic"
        status: 204

  plans:<commit_msg>minor additions to example API<commit_after># Imaginary API of a GitHub knockoff

exports.media_type = media_type = (name) ->
  "application/vnd.gh-knockoff.#{name}+json;version=1.0"

exports.schema =
  id: "gh-knockoff"
  properties:

    resource:
      type: "object"
      properties:
        url:
          type: "string"
          format: "uri"

    organization:
      extends: {$ref: "#resource"}
      mediaType: media_type("organization")
      properties:
        name: {type: "string"}
        plan: {$ref: "#plan"}
        projects:
          # Here's how you describe a dictionary
          type: "object"
          additionalProperties: {$ref: "#project"}
        members: {$ref: "#user_list"}

    organization_list:
      type: "object"
      mediaType: media_type("organization_list")
      additionalProperties: {$ref: "#organization"}


    plan:
      extends: {$ref: "#resource"}
      mediaType: media_type("plan")
      properties:
        name: {type: "string"}
        space: {type: "integer"}
        bandwidth: {type: "integer"}

    plan_list:
      type: "object"
      mediaType: media_type("plan_list")
      additionalProperties: {$ref: "#plan"}

    user:
      extends: {$ref: "#resource"}
      mediaType: media_type("user")
      properties:
        name: {type: "string"}
        email: {type: "string"}

    user_list:
      mediaType: media_type("user_list")
      type: "array"
      items: {$ref: "#user"}


    project:
      extends: {$ref: "#resource"}
      mediaType: media_type("project")
      properties:
        name: {type: "string"}
        description: {type: "string"}
        refs:
          type: "object"
          properties:
            main: {$ref: "#branch"}
            branches:
              type: "object"
              additionalProperties: {$ref: "#branch"}
            tags:
              type: "array"
              items: {$ref: "#tag"}

    project_list:
      mediaType: media_type("project_list")
      type: "array"
      items: {$ref: "#project"}


    reference:
      extends: {$ref: "#resource"}
      mediaType: media_type("reference")
      properties:
        name:
          required: true
          type: "string"
        commit:
          required: true
          type: "string"
        message:
          required: true
          type: "string"

    branch:
      extends: {$ref: "#reference"}
      mediaType: media_type("branch")

    tag:
      extends: {$ref: "#reference"}
      mediaType: media_type("tag")



exports.resources =

  organizations:
    actions:

      create:
        method: "POST"
        request_schema: "organization"
        response_schema: "organization"
        status: 201

      search:
        method: "GET"
        response_schema: "organization_list"
        query:
          q:
            required: true
            type: "string"
          limit:
            type: "integer"
          offset:
            type: "integer"
          sort:
            type: "string"
            enum: ["asc", "desc"]
        status: 200

  organization:
    actions:
      get:
        method: "GET"
        response_schema: "organization"
        status: 200

      update:
        method: "PUT"
        request_schema: "organization"
        response_schema: "organization"
        authorization: "Basic"
        status: 200

      delete:
        method: "DELETE"
        authorization: "Basic"
        status: 204

  plans:
{'fraction_non_alphanumeric': 0.12636786089042124, 'fraction_numerical': 0.005096687153350322, 'mean_word_length': 1.9122653862941947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1742445', 'n_tokens_mistral': 1962, 'n_tokens_neox': 1873, 'n_words': 479}