Skip to content

Use a schema for message validation and description #120

@yeraydavidrodriguez

Description

@yeraydavidrodriguez

When the issue #24 is merged, we will have JTD schema validation for the message body:

interface CommitBodyMetaData {
  job_number?: number
  job_commit?: string
}

interface CommitBodyData {
  namespace: 'git-queue.commit-body'
  version: number
  metadata: CommitBodyMetaData
  payload: string
}

const CommitBodySchema: JTDSchemaType<CommitBodyData> = {
  properties: {
    namespace: {enum: ['git-queue.commit-body']},
    version: {type: 'int32'},
    payload: {type: 'string'},
    metadata: {
      optionalProperties: {
        job_number: {type: 'int32'},
        job_commit: {type: 'string'}
      },
      additionalProperties: true
    }
  },
  additionalProperties: true
}

This allows us to have an expressive description of the commit body, and make validations and parsings more robust and simple.

This methodology should be extended to the commit subject, that will store the queue message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions