Skip to content

Commit

Permalink
Show error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
ursm committed Jun 11, 2024
1 parent 63b5243 commit e50b7ad
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions api/app/models/ddbj_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ def validate(validation)

obj.update! validity:, validation_details: details.fetch(:messages).map {|msg|
{
**msg.slice(:id, :message),
severity: msg.fetch(:level)
code: msg[:id],
severity: msg[:level],
message: msg[:message]
}
}
end
Expand Down
2 changes: 1 addition & 1 deletion schema/openapi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export interface components {
/** @enum {string|null} */
validity: "valid" | "invalid" | "error" | null;
details: {
id: string;
code: string;
severity: string;
message: string;
}[] | null;
Expand Down
4 changes: 2 additions & 2 deletions schema/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -733,10 +733,10 @@ components:
items:
type: object
additionalProperties: false
required: [id, severity, message]
required: [code, severity, message]

properties:
id:
code:
type: string

severity:
Expand Down
4 changes: 2 additions & 2 deletions schema/openapi.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -691,10 +691,10 @@ components:
items:
type: object
additionalProperties: false
required: [id, severity, message]
required: [code, severity, message]

properties:
id:
code:
type: string

severity:
Expand Down
2 changes: 1 addition & 1 deletion schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"openapi-typescript": "^6.7.6",
"quicktype": "^23.0.170"
},
"packageManager": "pnpm@9.1.4"
"packageManager": "pnpm@9.2.0"
}
4 changes: 2 additions & 2 deletions web/app/components/validation.gts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default class ValidationComponent extends Component<Signature> {
<table class='table m-0'>
<thead>
<tr>
<th>ID</th>
<th>Code</th>
<th>Severity</th>
<th>Message</th>
</tr>
Expand All @@ -165,7 +165,7 @@ export default class ValidationComponent extends Component<Signature> {
{{#each result.details as |detail i|}}
<tr>
{{#let (eq i (sub (array result.details.length 1))) as |isLast|}}
<td class={{if isLast 'border-bottom-0'}}>{{if detail.id detail.id '-'}}</td>
<td class={{if isLast 'border-bottom-0'}}>{{if detail.code detail.code '-'}}</td>
<td class={{if isLast 'border-bottom-0'}}>{{if detail.severity detail.severity '-'}}</td>
<td class={{if isLast 'border-bottom-0'}}>{{detail.message}}</td>
{{/let}}
Expand Down

0 comments on commit e50b7ad

Please sign in to comment.