@@ -95,6 +95,30 @@ paths:
|
||||
schema:
|
||||
$ref: '#/components/schemas/PackagesCreateRsp'
|
||||
/v1/packages/{id}:
|
||||
get:
|
||||
tags:
|
||||
- PkgdashService
|
||||
operationId: PackagesLookup
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: uint64
|
||||
responses:
|
||||
default:
|
||||
description: Default
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorRsp'
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/PackagesLookupRsp'
|
||||
put:
|
||||
tags:
|
||||
- PkgdashService
|
||||
@@ -149,6 +173,31 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/PackagesDeleteRsp'
|
||||
/v1/packages/{id}/modules:
|
||||
get:
|
||||
tags:
|
||||
- PkgdashService
|
||||
operationId: PackagesModules
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: uint64
|
||||
responses:
|
||||
default:
|
||||
description: Default
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorRsp'
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/PackagesModulesRsp'
|
||||
/v1/packages/{package_id}/comments:
|
||||
get:
|
||||
tags:
|
||||
@@ -246,7 +295,7 @@ components:
|
||||
package:
|
||||
type: integer
|
||||
format: uint64
|
||||
text:
|
||||
comment:
|
||||
type: string
|
||||
created:
|
||||
type: string
|
||||
@@ -260,7 +309,7 @@ components:
|
||||
package_id:
|
||||
type: integer
|
||||
format: uint64
|
||||
text:
|
||||
comment:
|
||||
type: string
|
||||
CommentsCreateRsp:
|
||||
type: object
|
||||
@@ -332,26 +381,23 @@ components:
|
||||
url:
|
||||
type: string
|
||||
modules:
|
||||
type: array
|
||||
items:
|
||||
type: integer
|
||||
format: uint64
|
||||
type: integer
|
||||
format: uint64
|
||||
issues:
|
||||
type: array
|
||||
items:
|
||||
type: integer
|
||||
format: uint64
|
||||
type: integer
|
||||
format: uint64
|
||||
comments:
|
||||
type: array
|
||||
items:
|
||||
type: integer
|
||||
format: uint64
|
||||
type: integer
|
||||
format: uint64
|
||||
created:
|
||||
type: string
|
||||
format: RFC3339
|
||||
updated:
|
||||
type: string
|
||||
format: RFC3339
|
||||
last_check:
|
||||
type: string
|
||||
format: RFC3339
|
||||
PackagesCreateReq:
|
||||
type: object
|
||||
properties:
|
||||
@@ -367,8 +413,8 @@ components:
|
||||
PackagesCreateRsp:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
package:
|
||||
$ref: '#/components/schemas/Package'
|
||||
PackagesDeleteRsp:
|
||||
type: object
|
||||
properties: {}
|
||||
@@ -379,6 +425,18 @@ components:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Package'
|
||||
PackagesLookupRsp:
|
||||
type: object
|
||||
properties:
|
||||
package:
|
||||
$ref: '#/components/schemas/Package'
|
||||
PackagesModulesRsp:
|
||||
type: object
|
||||
properties:
|
||||
modules:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Module'
|
||||
PackagesUpdateReq:
|
||||
type: object
|
||||
properties:
|
||||
|
1103
proto/pkgdash.pb.go
1103
proto/pkgdash.pb.go
File diff suppressed because it is too large
Load Diff
@@ -35,6 +35,477 @@ var (
|
||||
_ = sort.Sort
|
||||
)
|
||||
|
||||
// Validate checks the field values on PackagesModulesReq with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
func (m *PackagesModulesReq) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on PackagesModulesReq with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// PackagesModulesReqMultiError, or nil if none found.
|
||||
func (m *PackagesModulesReq) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *PackagesModulesReq) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for Id
|
||||
|
||||
if len(errors) > 0 {
|
||||
return PackagesModulesReqMultiError(errors)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// PackagesModulesReqMultiError is an error wrapping multiple validation errors
|
||||
// returned by PackagesModulesReq.ValidateAll() if the designated constraints
|
||||
// aren't met.
|
||||
type PackagesModulesReqMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m PackagesModulesReqMultiError) Error() string {
|
||||
var msgs []string
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m PackagesModulesReqMultiError) AllErrors() []error { return m }
|
||||
|
||||
// PackagesModulesReqValidationError is the validation error returned by
|
||||
// PackagesModulesReq.Validate if the designated constraints aren't met.
|
||||
type PackagesModulesReqValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e PackagesModulesReqValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e PackagesModulesReqValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e PackagesModulesReqValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e PackagesModulesReqValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e PackagesModulesReqValidationError) ErrorName() string {
|
||||
return "PackagesModulesReqValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e PackagesModulesReqValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sPackagesModulesReq.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = PackagesModulesReqValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = PackagesModulesReqValidationError{}
|
||||
|
||||
// Validate checks the field values on PackagesModulesRsp with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
func (m *PackagesModulesRsp) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on PackagesModulesRsp with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// PackagesModulesRspMultiError, or nil if none found.
|
||||
func (m *PackagesModulesRsp) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *PackagesModulesRsp) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
for idx, item := range m.GetModules() {
|
||||
_, _ = idx, item
|
||||
|
||||
if all {
|
||||
switch v := interface{}(item).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, PackagesModulesRspValidationError{
|
||||
field: fmt.Sprintf("Modules[%v]", idx),
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, PackagesModulesRspValidationError{
|
||||
field: fmt.Sprintf("Modules[%v]", idx),
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return PackagesModulesRspValidationError{
|
||||
field: fmt.Sprintf("Modules[%v]", idx),
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(errors) > 0 {
|
||||
return PackagesModulesRspMultiError(errors)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// PackagesModulesRspMultiError is an error wrapping multiple validation errors
|
||||
// returned by PackagesModulesRsp.ValidateAll() if the designated constraints
|
||||
// aren't met.
|
||||
type PackagesModulesRspMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m PackagesModulesRspMultiError) Error() string {
|
||||
var msgs []string
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m PackagesModulesRspMultiError) AllErrors() []error { return m }
|
||||
|
||||
// PackagesModulesRspValidationError is the validation error returned by
|
||||
// PackagesModulesRsp.Validate if the designated constraints aren't met.
|
||||
type PackagesModulesRspValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e PackagesModulesRspValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e PackagesModulesRspValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e PackagesModulesRspValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e PackagesModulesRspValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e PackagesModulesRspValidationError) ErrorName() string {
|
||||
return "PackagesModulesRspValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e PackagesModulesRspValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sPackagesModulesRsp.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = PackagesModulesRspValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = PackagesModulesRspValidationError{}
|
||||
|
||||
// Validate checks the field values on PackagesLookupReq with the rules defined
|
||||
// in the proto definition for this message. If any rules are violated, the
|
||||
// first error encountered is returned, or nil if there are no violations.
|
||||
func (m *PackagesLookupReq) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on PackagesLookupReq with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// PackagesLookupReqMultiError, or nil if none found.
|
||||
func (m *PackagesLookupReq) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *PackagesLookupReq) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for Id
|
||||
|
||||
if len(errors) > 0 {
|
||||
return PackagesLookupReqMultiError(errors)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// PackagesLookupReqMultiError is an error wrapping multiple validation errors
|
||||
// returned by PackagesLookupReq.ValidateAll() if the designated constraints
|
||||
// aren't met.
|
||||
type PackagesLookupReqMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m PackagesLookupReqMultiError) Error() string {
|
||||
var msgs []string
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m PackagesLookupReqMultiError) AllErrors() []error { return m }
|
||||
|
||||
// PackagesLookupReqValidationError is the validation error returned by
|
||||
// PackagesLookupReq.Validate if the designated constraints aren't met.
|
||||
type PackagesLookupReqValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e PackagesLookupReqValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e PackagesLookupReqValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e PackagesLookupReqValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e PackagesLookupReqValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e PackagesLookupReqValidationError) ErrorName() string {
|
||||
return "PackagesLookupReqValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e PackagesLookupReqValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sPackagesLookupReq.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = PackagesLookupReqValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = PackagesLookupReqValidationError{}
|
||||
|
||||
// Validate checks the field values on PackagesLookupRsp with the rules defined
|
||||
// in the proto definition for this message. If any rules are violated, the
|
||||
// first error encountered is returned, or nil if there are no violations.
|
||||
func (m *PackagesLookupRsp) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on PackagesLookupRsp with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// PackagesLookupRspMultiError, or nil if none found.
|
||||
func (m *PackagesLookupRsp) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *PackagesLookupRsp) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
if all {
|
||||
switch v := interface{}(m.GetPackage()).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, PackagesLookupRspValidationError{
|
||||
field: "Package",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, PackagesLookupRspValidationError{
|
||||
field: "Package",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if v, ok := interface{}(m.GetPackage()).(interface{ Validate() error }); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return PackagesLookupRspValidationError{
|
||||
field: "Package",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(errors) > 0 {
|
||||
return PackagesLookupRspMultiError(errors)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// PackagesLookupRspMultiError is an error wrapping multiple validation errors
|
||||
// returned by PackagesLookupRsp.ValidateAll() if the designated constraints
|
||||
// aren't met.
|
||||
type PackagesLookupRspMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m PackagesLookupRspMultiError) Error() string {
|
||||
var msgs []string
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m PackagesLookupRspMultiError) AllErrors() []error { return m }
|
||||
|
||||
// PackagesLookupRspValidationError is the validation error returned by
|
||||
// PackagesLookupRsp.Validate if the designated constraints aren't met.
|
||||
type PackagesLookupRspValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e PackagesLookupRspValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e PackagesLookupRspValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e PackagesLookupRspValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e PackagesLookupRspValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e PackagesLookupRspValidationError) ErrorName() string {
|
||||
return "PackagesLookupRspValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e PackagesLookupRspValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sPackagesLookupRsp.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = PackagesLookupRspValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = PackagesLookupRspValidationError{}
|
||||
|
||||
// Validate checks the field values on ErrorRsp with the rules defined in the
|
||||
// proto definition for this message. If any rules are violated, the first
|
||||
// error encountered is returned, or nil if there are no violations.
|
||||
@@ -195,6 +666,12 @@ func (m *Package) validate(all bool) error {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
// no validation rules for Modules
|
||||
|
||||
// no validation rules for Issues
|
||||
|
||||
// no validation rules for Comments
|
||||
|
||||
if all {
|
||||
switch v := interface{}(m.GetCreated()).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
@@ -253,6 +730,35 @@ func (m *Package) validate(all bool) error {
|
||||
}
|
||||
}
|
||||
|
||||
if all {
|
||||
switch v := interface{}(m.GetLastCheck()).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, PackageValidationError{
|
||||
field: "LastCheck",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, PackageValidationError{
|
||||
field: "LastCheck",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if v, ok := interface{}(m.GetLastCheck()).(interface{ Validate() error }); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return PackageValidationError{
|
||||
field: "LastCheck",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(errors) > 0 {
|
||||
return PackageMultiError(errors)
|
||||
}
|
||||
@@ -781,7 +1287,7 @@ func (m *Comment) validate(all bool) error {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
// no validation rules for Text
|
||||
// no validation rules for Comment
|
||||
|
||||
if all {
|
||||
switch v := interface{}(m.GetCreated()).(type) {
|
||||
@@ -1856,7 +2362,7 @@ func (m *CommentsCreateReq) validate(all bool) error {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
// no validation rules for Text
|
||||
// no validation rules for Comment
|
||||
|
||||
if len(errors) > 0 {
|
||||
return CommentsCreateReqMultiError(errors)
|
||||
@@ -2212,15 +2718,33 @@ func (m *PackagesCreateRsp) validate(all bool) error {
|
||||
|
||||
var errors []error
|
||||
|
||||
if utf8.RuneCountInString(m.GetStatus()) < 1 {
|
||||
err := PackagesCreateRspValidationError{
|
||||
field: "Status",
|
||||
reason: "value length must be at least 1 runes",
|
||||
if all {
|
||||
switch v := interface{}(m.GetPackage()).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, PackagesCreateRspValidationError{
|
||||
field: "Package",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, PackagesCreateRspValidationError{
|
||||
field: "Package",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
} else if v, ok := interface{}(m.GetPackage()).(interface{ Validate() error }); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return PackagesCreateRspValidationError{
|
||||
field: "Package",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if len(errors) > 0 {
|
||||
|
@@ -3,13 +3,26 @@ syntax = "proto3";
|
||||
package pkgdash;
|
||||
|
||||
import "api/annotations.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "openapiv3/annotations.proto";
|
||||
import "validate/validate.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "go.unistack.org/unistack-org/pkgdash/proto;pkgdashpb";
|
||||
|
||||
service PkgdashService {
|
||||
rpc PackagesLookup(PackagesLookupReq) returns (PackagesLookupRsp) {
|
||||
option (micro.openapiv3.openapiv3_operation) = {
|
||||
operation_id: "PackagesLookup";
|
||||
responses: {
|
||||
default: {
|
||||
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||||
};
|
||||
};
|
||||
};
|
||||
option (micro.api.http) = {
|
||||
get: "/v1/packages/{id}";
|
||||
};
|
||||
}
|
||||
rpc PackagesCreate(PackagesCreateReq) returns (PackagesCreateRsp) {
|
||||
option (micro.openapiv3.openapiv3_operation) = {
|
||||
operation_id: "PackagesCreate";
|
||||
@@ -46,6 +59,17 @@ service PkgdashService {
|
||||
};
|
||||
option (micro.api.http) = {get: "/v1/packages"};
|
||||
}
|
||||
rpc PackagesModules(PackagesModulesReq) returns (PackagesModulesRsp) {
|
||||
option (micro.openapiv3.openapiv3_operation) = {
|
||||
operation_id: "PackagesModules";
|
||||
responses: {
|
||||
default: {
|
||||
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||||
};
|
||||
};
|
||||
};
|
||||
option (micro.api.http) = {get: "/v1/packages/{id}/modules"};
|
||||
}
|
||||
rpc PackagesUpdate(PackagesUpdateReq) returns (PackagesUpdateRsp) {
|
||||
option (micro.openapiv3.openapiv3_operation) = {
|
||||
operation_id: "PackagesUpdate";
|
||||
@@ -126,6 +150,22 @@ service PkgdashService {
|
||||
}
|
||||
}
|
||||
|
||||
message PackagesModulesReq {
|
||||
uint64 id = 1 [json_name = "id"];
|
||||
}
|
||||
|
||||
message PackagesModulesRsp {
|
||||
repeated Module modules = 1 [json_name = "modules"];
|
||||
}
|
||||
|
||||
message PackagesLookupReq {
|
||||
uint64 id = 1 [json_name = "id"];
|
||||
}
|
||||
|
||||
message PackagesLookupRsp {
|
||||
Package package = 1 [json_name = "package"];
|
||||
}
|
||||
|
||||
message ErrorRsp {
|
||||
string code = 1 [json_name = "code"];
|
||||
string title = 2 [json_name = "title"];
|
||||
@@ -137,11 +177,12 @@ message Package {
|
||||
uint64 id = 1 [(validate.rules).uint64.gt = 0];
|
||||
string name = 2 [(validate.rules).string.min_len = 1];
|
||||
string url = 3 [(validate.rules).string.min_len = 1];
|
||||
repeated uint64 modules = 4;
|
||||
repeated uint64 issues = 5;
|
||||
repeated uint64 comments = 6;
|
||||
uint64 modules = 4;
|
||||
uint64 issues = 5;
|
||||
uint64 comments = 6;
|
||||
google.protobuf.Timestamp created = 7;
|
||||
google.protobuf.Timestamp updated = 8;
|
||||
google.protobuf.Timestamp last_check = 9;
|
||||
}
|
||||
|
||||
message Module {
|
||||
@@ -167,7 +208,7 @@ message Issue {
|
||||
message Comment {
|
||||
uint64 id = 1 [(validate.rules).uint64.gt = 0];
|
||||
uint64 package = 2 [(validate.rules).uint64.gt = 0];
|
||||
string text = 3;
|
||||
string comment = 3;
|
||||
google.protobuf.Timestamp created = 4;
|
||||
google.protobuf.Timestamp updated = 5;
|
||||
}
|
||||
@@ -208,7 +249,7 @@ message CommentsCreateReq {
|
||||
json_name = "package_id",
|
||||
(validate.rules).uint64.gt = 0
|
||||
];
|
||||
string text = 2;
|
||||
string comment = 2;
|
||||
}
|
||||
|
||||
message CommentsCreateRsp {
|
||||
@@ -222,13 +263,13 @@ message PackagesCreateReq {
|
||||
}
|
||||
|
||||
message PackagesCreateRsp {
|
||||
string status = 1 [(validate.rules).string.min_len = 1];
|
||||
Package package = 1 [json_name="package"];
|
||||
}
|
||||
|
||||
message ModulesListReq {}
|
||||
|
||||
message ModulesListRsp {
|
||||
repeated Module modules = 1;
|
||||
repeated Module modules = 1 [json_name="modules"];
|
||||
}
|
||||
|
||||
message CommentsListReq {
|
||||
|
@@ -17,9 +17,11 @@ var (
|
||||
)
|
||||
|
||||
type PkgdashServiceClient interface {
|
||||
PackagesLookup(ctx context.Context, req *PackagesLookupReq, opts ...options.Option) (*PackagesLookupRsp, error)
|
||||
PackagesCreate(ctx context.Context, req *PackagesCreateReq, opts ...options.Option) (*PackagesCreateRsp, error)
|
||||
PackagesDelete(ctx context.Context, req *PackagesDeleteReq, opts ...options.Option) (*PackagesDeleteRsp, error)
|
||||
PackagesList(ctx context.Context, req *PackagesListReq, opts ...options.Option) (*PackagesListRsp, error)
|
||||
PackagesModules(ctx context.Context, req *PackagesModulesReq, opts ...options.Option) (*PackagesModulesRsp, error)
|
||||
PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, opts ...options.Option) (*PackagesUpdateRsp, error)
|
||||
CommentsCreate(ctx context.Context, req *CommentsCreateReq, opts ...options.Option) (*CommentsCreateRsp, error)
|
||||
CommentsLookup(ctx context.Context, req *CommentsLookupReq, opts ...options.Option) (*CommentsLookupRsp, error)
|
||||
@@ -29,9 +31,11 @@ type PkgdashServiceClient interface {
|
||||
}
|
||||
|
||||
type PkgdashServiceServer interface {
|
||||
PackagesLookup(ctx context.Context, req *PackagesLookupReq, rsp *PackagesLookupRsp) error
|
||||
PackagesCreate(ctx context.Context, req *PackagesCreateReq, rsp *PackagesCreateRsp) error
|
||||
PackagesDelete(ctx context.Context, req *PackagesDeleteReq, rsp *PackagesDeleteRsp) error
|
||||
PackagesList(ctx context.Context, req *PackagesListReq, rsp *PackagesListRsp) error
|
||||
PackagesModules(ctx context.Context, req *PackagesModulesReq, rsp *PackagesModulesRsp) error
|
||||
PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, rsp *PackagesUpdateRsp) error
|
||||
CommentsCreate(ctx context.Context, req *CommentsCreateReq, rsp *CommentsCreateRsp) error
|
||||
CommentsLookup(ctx context.Context, req *CommentsLookupReq, rsp *CommentsLookupRsp) error
|
||||
|
@@ -16,6 +16,13 @@ import (
|
||||
|
||||
var (
|
||||
PkgdashServiceServerEndpoints = []v4.EndpointMetadata{
|
||||
{
|
||||
Name: "PkgdashService.PackagesLookup",
|
||||
Path: "/v1/packages/{id}",
|
||||
Method: "GET",
|
||||
Body: "",
|
||||
Stream: false,
|
||||
},
|
||||
{
|
||||
Name: "PkgdashService.PackagesCreate",
|
||||
Path: "/v1/packages",
|
||||
@@ -37,6 +44,13 @@ var (
|
||||
Body: "",
|
||||
Stream: false,
|
||||
},
|
||||
{
|
||||
Name: "PkgdashService.PackagesModules",
|
||||
Path: "/v1/packages/{id}/modules",
|
||||
Method: "GET",
|
||||
Body: "",
|
||||
Stream: false,
|
||||
},
|
||||
{
|
||||
Name: "PkgdashService.PackagesUpdate",
|
||||
Path: "/v1/packages/{id}",
|
||||
@@ -105,6 +119,24 @@ func NewPkgdashServiceClient(name string, c client.Client) PkgdashServiceClient
|
||||
return &pkgdashServiceClient{c: c, name: name}
|
||||
}
|
||||
|
||||
func (c *pkgdashServiceClient) PackagesLookup(ctx context.Context, req *PackagesLookupReq, opts ...options.Option) (*PackagesLookupRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &ErrorRsp{}
|
||||
opts = append(opts,
|
||||
v41.ErrorMap(errmap),
|
||||
)
|
||||
opts = append(opts,
|
||||
v41.Method(http.MethodGet),
|
||||
v41.Path("/v1/packages/{id}"),
|
||||
)
|
||||
rsp := &PackagesLookupRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.PackagesLookup", req), rsp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func (c *pkgdashServiceClient) PackagesCreate(ctx context.Context, req *PackagesCreateReq, opts ...options.Option) (*PackagesCreateRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &ErrorRsp{}
|
||||
@@ -160,6 +192,24 @@ func (c *pkgdashServiceClient) PackagesList(ctx context.Context, req *PackagesLi
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func (c *pkgdashServiceClient) PackagesModules(ctx context.Context, req *PackagesModulesReq, opts ...options.Option) (*PackagesModulesRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &ErrorRsp{}
|
||||
opts = append(opts,
|
||||
v41.ErrorMap(errmap),
|
||||
)
|
||||
opts = append(opts,
|
||||
v41.Method(http.MethodGet),
|
||||
v41.Path("/v1/packages/{id}/modules"),
|
||||
)
|
||||
rsp := &PackagesModulesRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.PackagesModules", req), rsp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func (c *pkgdashServiceClient) PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, opts ...options.Option) (*PackagesUpdateRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &ErrorRsp{}
|
||||
@@ -274,6 +324,10 @@ type pkgdashServiceServer struct {
|
||||
PkgdashServiceServer
|
||||
}
|
||||
|
||||
func (h *pkgdashServiceServer) PackagesLookup(ctx context.Context, req *PackagesLookupReq, rsp *PackagesLookupRsp) error {
|
||||
return h.PkgdashServiceServer.PackagesLookup(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func (h *pkgdashServiceServer) PackagesCreate(ctx context.Context, req *PackagesCreateReq, rsp *PackagesCreateRsp) error {
|
||||
return h.PkgdashServiceServer.PackagesCreate(ctx, req, rsp)
|
||||
}
|
||||
@@ -286,6 +340,10 @@ func (h *pkgdashServiceServer) PackagesList(ctx context.Context, req *PackagesLi
|
||||
return h.PkgdashServiceServer.PackagesList(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func (h *pkgdashServiceServer) PackagesModules(ctx context.Context, req *PackagesModulesReq, rsp *PackagesModulesRsp) error {
|
||||
return h.PkgdashServiceServer.PackagesModules(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func (h *pkgdashServiceServer) PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, rsp *PackagesUpdateRsp) error {
|
||||
return h.PkgdashServiceServer.PackagesUpdate(ctx, req, rsp)
|
||||
}
|
||||
@@ -312,9 +370,11 @@ func (h *pkgdashServiceServer) ModulesList(ctx context.Context, req *ModulesList
|
||||
|
||||
func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts ...options.Option) error {
|
||||
type pkgdashService interface {
|
||||
PackagesLookup(ctx context.Context, req *PackagesLookupReq, rsp *PackagesLookupRsp) error
|
||||
PackagesCreate(ctx context.Context, req *PackagesCreateReq, rsp *PackagesCreateRsp) error
|
||||
PackagesDelete(ctx context.Context, req *PackagesDeleteReq, rsp *PackagesDeleteRsp) error
|
||||
PackagesList(ctx context.Context, req *PackagesListReq, rsp *PackagesListRsp) error
|
||||
PackagesModules(ctx context.Context, req *PackagesModulesReq, rsp *PackagesModulesRsp) error
|
||||
PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, rsp *PackagesUpdateRsp) error
|
||||
CommentsCreate(ctx context.Context, req *CommentsCreateReq, rsp *CommentsCreateRsp) error
|
||||
CommentsLookup(ctx context.Context, req *CommentsLookupReq, rsp *CommentsLookupRsp) error
|
||||
|
Reference in New Issue
Block a user