Feat/catalog#116
Conversation
matcornic
left a comment
There was a problem hiding this comment.
Que sont ces fichiers/dossiers ? newman-docker et npm-27139-9e3ad190/registry.npmjs.org/cli-table2/-/cli-table2-0.2.0.tgz.489355601
| @@ -0,0 +1,513 @@ | |||
| { | |||
There was a problem hiding this comment.
Fichiers postman à mettre dans un dossier resources/postman.
There was a problem hiding this comment.
Je ne trouve pas d'erreur flagrantes dans ce qui est écrit, ça me parait bien.
Par contre, la validation syntaxique et sémantique des structures et sous-structures n'est quasi pas présente. Il manque toute cette partie là qui est quand même très importante.
Pour l'instant seul la vérification du format du title et l'unicité du nom ont été vérifiés en base.
| } | ||
|
|
||
| // Member is user whois subscribed to the groupe. His role in this group defines what he is able to do. | ||
| // Member is user who is subscribed to the groupe. His role in this group defines what he is able to do. |
| return c.String(http.StatusBadRequest, fmt.Sprintf("Some fields of catalogService are not valid: %v", err)) | ||
| } | ||
|
|
||
| // Validate fields that cIannot be validated by validator engine |
|
|
||
| existingCatalogServiceIDs := []bson.ObjectId{} | ||
|
|
||
| // Get all real groups |
| Updated time.Time `bson:"updated" json:"updated"` | ||
| } | ||
|
|
||
| // NewCatalogService creates new catalogService for another one. |
| } | ||
|
|
||
| // Validate fields from validator tags for common types | ||
| if err := c.Validate(catalogService); err != nil { |
There was a problem hiding this comment.
On ne valide rien ici car la structure CatalogueService et toutes les sous-structures ne contient pas de flags 'validate'. Exemple : https://github.com/go-playground/validator/blob/v9/_examples/simple/main.go
Il faut valider au max ce qu'on peut avec cette librairie validate. Et pour les trucs plus compliqué, il y a la fonction en dessous.
| // Validate validates semantic of fields in a catalogService (like the name) | ||
| func (s CatalogService) Validate() error { | ||
|
|
||
| if !catalogServiceNameRegex.MatchString(s.Name) { |
There was a problem hiding this comment.
Lors de la validation, on doit valider toute la structure, y compris les sous-structure.
|
Travis a cassé également : |
Codecov Report
@@ Coverage Diff @@
## golang #116 +/- ##
==========================================
- Coverage 46.09% 45.54% -0.56%
==========================================
Files 14 14
Lines 909 920 +11
==========================================
Hits 419 419
- Misses 465 476 +11
Partials 25 25
Continue to review full report at Codecov.
|
No description provided.