Verified Commit 70661f66 authored by Loïc Dachary's avatar Loïc Dachary
Browse files

JSON schemas

parent acc0dbf6
Pipeline #574 passed with stage
in 17 minutes and 47 seconds
......@@ -28,21 +28,21 @@ func (c BasicIssueContext) ForeignID() int64 {
// Issue is a standard issue information
type Issue struct {
Number int64
PosterID int64 `yaml:"poster_id"`
PosterName string `yaml:"poster_name"`
PosterEmail string `yaml:"poster_email"`
Title string
Content string
Ref string
Milestone string
State string // closed, open
IsLocked bool `yaml:"is_locked"`
Created time.Time
Updated time.Time
Closed *time.Time
Labels []*Label
Reactions []*Reaction
Assignees []string
Number int64 `json:"number"`
PosterID int64 `yaml:"poster_id" json:"poster_id"`
PosterName string `yaml:"poster_name" json:"poster_name"`
PosterEmail string `yaml:"poster_email" json:"poster_email"`
Title string `json:"title"`
Content string `json:"content"`
Ref string `json:"ref"`
Milestone string `json:"milestone"`
State string `json:"state"` // closed, open
IsLocked bool `yaml:"is_locked" json:"is_locked"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
Closed *time.Time `json:"closed"`
Labels []*Label `json:"labels"`
Reactions []*Reaction `json:"reactions"`
Assignees []string `json:"assignees"`
Context IssueContext `yaml:"-"`
}
{
"title": "Issue",
"description": "Issue associated to a repository within a forge.",
"type": "object",
"additionalProperties": false,
"properties": {
"number": {
"description": "Unique identifier, relative to the repository.",
"type": "number",
},
"poster_id": {
"description": "Unique identifier of the user who authored the issue.",
"type": "number",
},
"poster_name": {
"description": "Name of the user who authored the issue.",
"type": "string",
},
"poster_email": {
"description": "Email of the user who authored the issue.",
"type": "string",
},
"title": {
"description": "Short description displayed as the title.",
"type": "string"
},
"content": {
"description": "Long, multiline, description.",
"type": "string"
},
"ref": {
"description": "Target branch in the repository.",
"type": "string",
},
"milestone": {
"description": "Name of the milestone.",
"type": "string",
},
"state": {
"description": "A 'closed' issue will not see any activity in the future, otherwise it is 'open'.",
"enum": [
"closed",
"open"
]
},
"is_locked": {
"description": "A locked issue can only be modified by privileged users.",
"type": "boolean",
},
"created": {
"description": "Creation time.",
"type": "string",
"format": "date-time"
},
"updated": {
"description": "Last update time.",
"type": "string",
"format": "date-time"
},
"closed": {
"description": "The last time 'state' changed to 'closed'.",
"type": "string",
"format": "date-time"
},
"labels": {
"description": "List of labels.",
"type": "array",
"items": {
"$ref": "http://example.com/label.json"
}
},
"reactions": {
"description": "List of reactions.",
"type": "array",
"items": {
"$ref": "http://example.com/reaction.json"
}
},
"assignees": {
"description": "List of assignees.",
"type": "array",
"items": {
"description": "Name of a user assigned to the issue.",
"type": "string",
}
},
},
"required": [
"number",
"poster_id",
"poster_name",
"title",
"content",
"state",
"is_locked",
"created"
"updated"
],
"$schema": "https://json-schema.org/draft/2020-12/schema#",
"$id": "http://example.com/issue.json",
"$$target": "issue.json"
}
......@@ -7,7 +7,7 @@ package migration
// Label defines a standard label information
type Label struct {
Name string
Color string
Description string
Name string `json:"name"`
Color string `json:"color"`
Description string `json:"description"`
}
{
"title": "Label",
"description": "Label associated to an issue.",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"description": "Name of the label, unique within the repository.",
"type": "string",
},
"color": {
"description": "Color code of the label.",
"type": "string",
},
"description": {
"description": "Long, multiline, description.",
"type": "string"
}
},
"required": [
"name"
],
"$schema": "https://json-schema.org/draft/2020-12/schema#",
"$id": "http://example.com/label.json",
"$$target": "label.json"
}
......@@ -6,7 +6,7 @@ package migration
// Reaction represents a reaction to an issue/pr/comment.
type Reaction struct {
UserID int64 `yaml:"user_id"`
UserName string `yaml:"user_name"`
Content string
UserID int64 `yaml:"user_id" json:"user_id"`
UserName string `yaml:"user_name" json:"user_name"`
Content string `json:"content"`
}
{
"title": "Reaction",
"description": "Reaction associated to an issue or a comment.",
"type": "object",
"additionalProperties": false,
"properties": {
"user_id": {
"description": "Unique identifier of the user who authored the reaction.",
"type": "number",
},
"user_name": {
"description": "Name of the user who authored the reaction.",
"type": "string",
},
"content": {
"description": "Representation of the reaction",
"type": "string"
}
},
"required": [
"user_id",
"content",
],
"$schema": "https://json-schema.org/draft/2020-12/schema#",
"$id": "http://example.com/reaction.json",
"$$target": "reaction.json"
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment