Skip to content
Snippets Groups Projects
Unverified Commit 78d257d3 authored by Bob Callaway's avatar Bob Callaway Committed by GitHub
Browse files

backoff go-swagger to last release (#118)

parent 34dff4c1
No related branches found
No related tags found
No related merge requests found
Showing
with 107 additions and 274 deletions
......@@ -28,8 +28,7 @@ jobs:
go-version: ${{ env.GOVERSION }}
# Download go-swagger
- name: download go-swagger
run : cp go.* $HOME && go get -u github.com/go-swagger/go-swagger/cmd/swagger@master && cp $HOME/go.* .
# run : go get -u github.com/go-swagger/go-swagger/cmd/swagger@v0.25.0
run : go get -u github.com/go-swagger/go-swagger/cmd/swagger@v0.25.0
- name: Validate OpenAPI with Swagger
run: swagger validate openapi.yaml
# Make it
......
......@@ -13,20 +13,23 @@ require (
github.com/go-openapi/errors v0.19.9
github.com/go-openapi/loads v0.20.0
github.com/go-openapi/runtime v0.19.24
github.com/go-openapi/spec v0.20.0
github.com/go-openapi/strfmt v0.19.11
github.com/go-openapi/swag v0.19.12
github.com/go-openapi/validate v0.20.0
github.com/go-openapi/spec v0.20.1
github.com/go-openapi/strfmt v0.20.0
github.com/go-openapi/swag v0.19.13
github.com/go-openapi/validate v0.20.1
github.com/go-swagger/go-swagger v0.25.0 // indirect
github.com/golang/protobuf v1.4.3
github.com/google/certificate-transparency-go v1.1.0 // indirect
github.com/google/trillian v1.3.10
github.com/gorilla/handlers v1.5.1 // indirect
github.com/jedisct1/go-minisign v0.0.0-20210106175330-e54e81d562c7
github.com/kr/pretty v0.2.1 // indirect
github.com/magiconair/properties v1.8.4 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/mapstructure v1.4.0
github.com/mitchellh/mapstructure v1.4.1
github.com/pelletier/go-toml v1.8.1 // indirect
github.com/rs/cors v1.7.0
github.com/spf13/afero v1.5.0 // indirect
github.com/spf13/afero v1.5.1 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cobra v1.0.0
github.com/spf13/jwalterweatherman v1.1.0 // indirect
......@@ -38,12 +41,13 @@ require (
go.uber.org/goleak v1.1.10
go.uber.org/zap v1.16.0
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
golang.org/x/mod v0.4.0 // indirect
golang.org/x/net v0.0.0-20201207224615-747e23833adb
golang.org/x/mod v0.4.1 // indirect
golang.org/x/net v0.0.0-20201224014010-6772e930b67b
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58 // indirect
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d // indirect
golang.org/x/tools v0.0.0-20201208062317-e652b2f42cc7 // indirect
golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78 // indirect
golang.org/x/text v0.3.5 // indirect
golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987
google.golang.org/grpc v1.32.0
......
This diff is collapsed.
......@@ -142,6 +142,7 @@ func (o *CreateLogEntryParams) WriteToRequest(r runtime.ClientRequest, reg strfm
if err := r.SetBodyParam(o.ProposedEntry); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
......
......@@ -149,6 +149,7 @@ func (o *GetLogEntryByIndexParams) WriteToRequest(r runtime.ClientRequest, reg s
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
......
......@@ -144,6 +144,7 @@ func (o *GetLogEntryByUUIDParams) WriteToRequest(r runtime.ClientRequest, reg st
if err := r.SetPathParam("entryUUID", o.EntryUUID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
......
......@@ -144,6 +144,7 @@ func (o *GetLogEntryProofParams) WriteToRequest(r runtime.ClientRequest, reg str
if err := r.SetPathParam("entryUUID", o.EntryUUID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
......
......@@ -144,6 +144,7 @@ func (o *SearchLogQueryParams) WriteToRequest(r runtime.ClientRequest, reg strfm
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
......
......@@ -183,6 +183,7 @@ func (o *GetLogProofParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
return err
}
}
}
// query param lastSize
......@@ -193,6 +194,7 @@ func (o *GetLogProofParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
......
......@@ -23,7 +23,6 @@ package models
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
......@@ -73,7 +72,7 @@ func (m *ConsistencyProof) validateHashes(formats strfmt.Registry) error {
for i := 0; i < len(m.Hashes); i++ {
if err := validate.Pattern("hashes"+"."+strconv.Itoa(i), "body", m.Hashes[i], `^[0-9a-fA-F]{64}$`); err != nil {
if err := validate.Pattern("hashes"+"."+strconv.Itoa(i), "body", string(m.Hashes[i]), `^[0-9a-fA-F]{64}$`); err != nil {
return err
}
......@@ -88,18 +87,13 @@ func (m *ConsistencyProof) validateRootHash(formats strfmt.Registry) error {
return err
}
if err := validate.Pattern("rootHash", "body", *m.RootHash, `^[0-9a-fA-F]{64}$`); err != nil {
if err := validate.Pattern("rootHash", "body", string(*m.RootHash), `^[0-9a-fA-F]{64}$`); err != nil {
return err
}
return nil
}
// ContextValidate validates this consistency proof based on context it is used
func (m *ConsistencyProof) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *ConsistencyProof) MarshalBinary() ([]byte, error) {
if m == nil {
......
......@@ -23,8 +23,6 @@ package models
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
......@@ -46,11 +44,6 @@ func (m *Error) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this error based on context it is used
func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *Error) MarshalBinary() ([]byte, error) {
if m == nil {
......
......@@ -23,7 +23,6 @@ package models
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
......@@ -91,7 +90,7 @@ func (m *InclusionProof) validateHashes(formats strfmt.Registry) error {
for i := 0; i < len(m.Hashes); i++ {
if err := validate.Pattern("hashes"+"."+strconv.Itoa(i), "body", m.Hashes[i], `^[0-9a-fA-F]{64}$`); err != nil {
if err := validate.Pattern("hashes"+"."+strconv.Itoa(i), "body", string(m.Hashes[i]), `^[0-9a-fA-F]{64}$`); err != nil {
return err
}
......@@ -106,7 +105,7 @@ func (m *InclusionProof) validateLogIndex(formats strfmt.Registry) error {
return err
}
if err := validate.MinimumInt("logIndex", "body", *m.LogIndex, 0, false); err != nil {
if err := validate.MinimumInt("logIndex", "body", int64(*m.LogIndex), 0, false); err != nil {
return err
}
......@@ -119,7 +118,7 @@ func (m *InclusionProof) validateRootHash(formats strfmt.Registry) error {
return err
}
if err := validate.Pattern("rootHash", "body", *m.RootHash, `^[0-9a-fA-F]{64}$`); err != nil {
if err := validate.Pattern("rootHash", "body", string(*m.RootHash), `^[0-9a-fA-F]{64}$`); err != nil {
return err
}
......@@ -132,18 +131,13 @@ func (m *InclusionProof) validateTreeSize(formats strfmt.Registry) error {
return err
}
if err := validate.MinimumInt("treeSize", "body", *m.TreeSize, 1, false); err != nil {
if err := validate.MinimumInt("treeSize", "body", int64(*m.TreeSize), 1, false); err != nil {
return err
}
return nil
}
// ContextValidate validates this inclusion proof based on context it is used
func (m *InclusionProof) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *InclusionProof) MarshalBinary() ([]byte, error) {
if m == nil {
......
......@@ -23,8 +23,6 @@ package models
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
......@@ -59,26 +57,6 @@ func (m LogEntry) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validate this log entry based on the context it is used
func (m LogEntry) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
for k := range m {
if val, ok := m[k]; ok {
if err := val.ContextValidate(ctx, formats); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// LogEntryAnon log entry anon
//
// swagger:model LogEntryAnon
......@@ -113,30 +91,22 @@ func (m *LogEntryAnon) Validate(formats strfmt.Registry) error {
func (m *LogEntryAnon) validateBody(formats strfmt.Registry) error {
if m.Body == nil {
return errors.Required("body", "body", nil)
}
return nil
}
func (m *LogEntryAnon) validateLogIndex(formats strfmt.Registry) error {
if swag.IsZero(m.LogIndex) { // not required
return nil
}
if err := validate.MinimumInt("logIndex", "body", *m.LogIndex, 0, false); err != nil {
if err := validate.MinimumInt("logIndex", "body", int64(*m.LogIndex), 0, false); err != nil {
return err
}
return nil
}
// ContextValidate validates this log entry anon based on context it is used
func (m *LogEntryAnon) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *LogEntryAnon) MarshalBinary() ([]byte, error) {
if m == nil {
......
......@@ -23,8 +23,6 @@ package models
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
......@@ -79,7 +77,7 @@ func (m *LogInfo) validateRootHash(formats strfmt.Registry) error {
return err
}
if err := validate.Pattern("rootHash", "body", *m.RootHash, `^[0-9a-fA-F]{64}$`); err != nil {
if err := validate.Pattern("rootHash", "body", string(*m.RootHash), `^[0-9a-fA-F]{64}$`); err != nil {
return err
}
......@@ -110,41 +108,13 @@ func (m *LogInfo) validateTreeSize(formats strfmt.Registry) error {
return err
}
if err := validate.MinimumInt("treeSize", "body", *m.TreeSize, 1, false); err != nil {
if err := validate.MinimumInt("treeSize", "body", int64(*m.TreeSize), 1, false); err != nil {
return err
}
return nil
}
// ContextValidate validate this log info based on the context it is used
func (m *LogInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateSignedTreeHead(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *LogInfo) contextValidateSignedTreeHead(ctx context.Context, formats strfmt.Registry) error {
if m.SignedTreeHead != nil {
if err := m.SignedTreeHead.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("signedTreeHead")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *LogInfo) MarshalBinary() ([]byte, error) {
if m == nil {
......@@ -233,11 +203,6 @@ func (m *LogInfoSignedTreeHead) validateSignature(formats strfmt.Registry) error
return nil
}
// ContextValidate validates this log info signed tree head based on context it is used
func (m *LogInfoSignedTreeHead) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *LogInfoSignedTreeHead) MarshalBinary() ([]byte, error) {
if m == nil {
......
......@@ -24,7 +24,6 @@ package models
import (
"bytes"
"context"
"encoding/json"
"io"
"io/ioutil"
......@@ -40,7 +39,6 @@ import (
// swagger:discriminator ProposedEntry kind
type ProposedEntry interface {
runtime.Validatable
runtime.ContextValidatable
// kind
// Required: true
......@@ -130,8 +128,3 @@ func unmarshalProposedEntry(data []byte, consumer runtime.Consumer) (ProposedEnt
func (m *proposedEntry) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this proposed entry based on context it is used
func (m *proposedEntry) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
......@@ -24,7 +24,6 @@ package models
import (
"bytes"
"context"
"encoding/json"
"github.com/go-openapi/errors"
......@@ -166,7 +165,7 @@ func (m *Rekord) validateAPIVersion(formats strfmt.Registry) error {
return err
}
if err := validate.Pattern("apiVersion", "body", *m.APIVersion, `^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$`); err != nil {
if err := validate.Pattern("apiVersion", "body", string(*m.APIVersion), `^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$`); err != nil {
return err
}
......@@ -175,23 +174,13 @@ func (m *Rekord) validateAPIVersion(formats strfmt.Registry) error {
func (m *Rekord) validateSpec(formats strfmt.Registry) error {
if m.Spec == nil {
return errors.Required("spec", "body", nil)
if err := validate.Required("spec", "body", m.Spec); err != nil {
return err
}
return nil
}
// ContextValidate validate this rekord based on the context it is used
func (m *Rekord) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// MarshalBinary interface implementation
func (m *Rekord) MarshalBinary() ([]byte, error) {
if m == nil {
......
......@@ -23,7 +23,6 @@ package models
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"github.com/go-openapi/errors"
......@@ -105,52 +104,6 @@ func (m *RekordV001Schema) validateSignature(formats strfmt.Registry) error {
return nil
}
// ContextValidate validate this rekord v001 schema based on the context it is used
func (m *RekordV001Schema) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateData(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateSignature(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *RekordV001Schema) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
if m.Data != nil {
if err := m.Data.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("data")
}
return err
}
}
return nil
}
func (m *RekordV001Schema) contextValidateSignature(ctx context.Context, formats strfmt.Registry) error {
if m.Signature != nil {
if err := m.Signature.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("signature")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *RekordV001Schema) MarshalBinary() ([]byte, error) {
if m == nil {
......@@ -205,6 +158,7 @@ func (m *RekordV001SchemaData) Validate(formats strfmt.Registry) error {
}
func (m *RekordV001SchemaData) validateHash(formats strfmt.Registry) error {
if swag.IsZero(m.Hash) { // not required
return nil
}
......@@ -222,6 +176,7 @@ func (m *RekordV001SchemaData) validateHash(formats strfmt.Registry) error {
}
func (m *RekordV001SchemaData) validateURL(formats strfmt.Registry) error {
if swag.IsZero(m.URL) { // not required
return nil
}
......@@ -233,34 +188,6 @@ func (m *RekordV001SchemaData) validateURL(formats strfmt.Registry) error {
return nil
}
// ContextValidate validate this rekord v001 schema data based on the context it is used
func (m *RekordV001SchemaData) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateHash(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *RekordV001SchemaData) contextValidateHash(ctx context.Context, formats strfmt.Registry) error {
if m.Hash != nil {
if err := m.Hash.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("data" + "." + "hash")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *RekordV001SchemaData) MarshalBinary() ([]byte, error) {
if m == nil {
......@@ -361,11 +288,6 @@ func (m *RekordV001SchemaDataHash) validateValue(formats strfmt.Registry) error
return nil
}
// ContextValidate validates this rekord v001 schema data hash based on context it is used
func (m *RekordV001SchemaDataHash) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *RekordV001SchemaDataHash) MarshalBinary() ([]byte, error) {
if m == nil {
......@@ -460,6 +382,7 @@ func (m *RekordV001SchemaSignature) validateFormatEnum(path, location string, va
}
func (m *RekordV001SchemaSignature) validateFormat(formats strfmt.Registry) error {
if swag.IsZero(m.Format) { // not required
return nil
}
......@@ -473,6 +396,7 @@ func (m *RekordV001SchemaSignature) validateFormat(formats strfmt.Registry) erro
}
func (m *RekordV001SchemaSignature) validatePublicKey(formats strfmt.Registry) error {
if swag.IsZero(m.PublicKey) { // not required
return nil
}
......@@ -490,6 +414,7 @@ func (m *RekordV001SchemaSignature) validatePublicKey(formats strfmt.Registry) e
}
func (m *RekordV001SchemaSignature) validateURL(formats strfmt.Registry) error {
if swag.IsZero(m.URL) { // not required
return nil
}
......@@ -501,34 +426,6 @@ func (m *RekordV001SchemaSignature) validateURL(formats strfmt.Registry) error {
return nil
}
// ContextValidate validate this rekord v001 schema signature based on the context it is used
func (m *RekordV001SchemaSignature) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidatePublicKey(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *RekordV001SchemaSignature) contextValidatePublicKey(ctx context.Context, formats strfmt.Registry) error {
if m.PublicKey != nil {
if err := m.PublicKey.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("signature" + "." + "publicKey")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *RekordV001SchemaSignature) MarshalBinary() ([]byte, error) {
if m == nil {
......@@ -576,6 +473,7 @@ func (m *RekordV001SchemaSignaturePublicKey) Validate(formats strfmt.Registry) e
}
func (m *RekordV001SchemaSignaturePublicKey) validateURL(formats strfmt.Registry) error {
if swag.IsZero(m.URL) { // not required
return nil
}
......@@ -587,11 +485,6 @@ func (m *RekordV001SchemaSignaturePublicKey) validateURL(formats strfmt.Registry
return nil
}
// ContextValidate validates this rekord v001 schema signature public key based on context it is used
func (m *RekordV001SchemaSignaturePublicKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *RekordV001SchemaSignaturePublicKey) MarshalBinary() ([]byte, error) {
if m == nil {
......
......@@ -24,7 +24,6 @@ package models
import (
"bytes"
"context"
"encoding/json"
"io"
"strconv"
......@@ -155,6 +154,7 @@ func (m *SearchLogQuery) Validate(formats strfmt.Registry) error {
}
func (m *SearchLogQuery) validateEntries(formats strfmt.Registry) error {
if swag.IsZero(m.Entries()) { // not required
return nil
}
......@@ -174,13 +174,14 @@ func (m *SearchLogQuery) validateEntries(formats strfmt.Registry) error {
}
func (m *SearchLogQuery) validateEntryUUIDs(formats strfmt.Registry) error {
if swag.IsZero(m.EntryUUIDs) { // not required
return nil
}
for i := 0; i < len(m.EntryUUIDs); i++ {
if err := validate.Pattern("entryUUIDs"+"."+strconv.Itoa(i), "body", m.EntryUUIDs[i], `^[0-9a-fA-F]{64}$`); err != nil {
if err := validate.Pattern("entryUUIDs"+"."+strconv.Itoa(i), "body", string(m.EntryUUIDs[i]), `^[0-9a-fA-F]{64}$`); err != nil {
return err
}
......@@ -190,6 +191,7 @@ func (m *SearchLogQuery) validateEntryUUIDs(formats strfmt.Registry) error {
}
func (m *SearchLogQuery) validateLogIndexes(formats strfmt.Registry) error {
if swag.IsZero(m.LogIndexes) { // not required
return nil
}
......@@ -205,37 +207,7 @@ func (m *SearchLogQuery) validateLogIndexes(formats strfmt.Registry) error {
continue
}
if err := validate.MinimumInt("logIndexes"+"."+strconv.Itoa(i), "body", *m.LogIndexes[i], 0, false); err != nil {
return err
}
}
return nil
}
// ContextValidate validate this search log query based on the context it is used
func (m *SearchLogQuery) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateEntries(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *SearchLogQuery) contextValidateEntries(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Entries()); i++ {
if err := m.entriesField[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("entries" + "." + strconv.Itoa(i))
}
if err := validate.MinimumInt("logIndexes"+"."+strconv.Itoa(i), "body", int64(*m.LogIndexes[i]), 0, false); err != nil {
return err
}
......
......@@ -1222,6 +1222,7 @@ func init() {
"entries": {
"type": "array",
"items": {
"minItems": 1,
"$ref": "#/definitions/ProposedEntry"
}
},
......@@ -1229,7 +1230,8 @@ func init() {
"type": "array",
"items": {
"type": "string",
"pattern": "^[0-9a-fA-F]{64}$"
"pattern": "^[0-9a-fA-F]{64}$",
"minItems": 1
}
},
"logIndexes": {
......
......@@ -65,12 +65,14 @@ func (o *CreateLogEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
r = rCtx
}
var Params = NewCreateLogEntryParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment