benoitdm-oslandia / pg_featureserv

Apache License 2.0
1 stars 0 forks source link

change return code for invalid data in handlePartialUpdateItem - [merged] #118

Closed benoitdm-oslandia closed 1 year ago

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 11, 2022, 17:57

_Merges feature/update_return_code_for_invalidjson -> develop

related #44

api/api.go

service/util.go

service/handler.go

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 11, 2022, 17:57

requested review from @azarz

benoitdm-oslandia commented 1 year ago
    errUnMarsh := json.Unmarshal(body, &val)

en fait ici, on récupère un schéma qui peut ne pas contenir les mm info que le GeojsonFeatureData.

benoitdm-oslandia commented 1 year ago

marked this merge request as draft

benoitdm-oslandia commented 1 year ago

bon départ ! :smile:

Est ce que tu peux ajouter les modifications pour les autres verbes http dans la mm PR stp ?

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 12, 2022, 08:42

Commented on internal/service/handler.go line 699

Du coup il faut utiliser quel schema ? J'ai utilisé le schema défini dans PartialUpdateTableFeature : https://git.oslandia.net/Client-projects/geoplateforme-ign-pg-featureserv/-/blob/develop/internal/data/catalog_db.go#L298.

Si je ne change pas le schema utilisé, aucune erreur n'est remonté par json.Unmarshal

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 12, 2022, 08:44

Je voulais faire une MR la plus petite possible, du coup je n'ai touché que à cette partie. Je vais le faire pour toute la fonction handlePartialUpdateItem

benoitdm-oslandia commented 1 year ago

Le test sur errUnMarsh ne vérifie que si le contenu est bien correct au niveau json. Le vrai test de validation du schema est fait un peu plus loin en ligne 704

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 12, 2022, 09:29

Commented on internal/service/handler.go line 699

Le test de validation du schema n'arrive pas en erreur en ligne 704. L'erreur ne se produit que dans PartialUpdateTableFeature.

Je propose de rajouter un json.Unmarshal de api.GeojsonFeatureData avant l'appel à PartialUpdateTableFeature

benoitdm-oslandia commented 1 year ago

vu en visio. Voir #63

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 12, 2022, 10:49

Commented on internal/service/handler.go line 699

changed this line in version 2 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 12, 2022, 10:49

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 12, 2022, 17:35

added 2 commits

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 14, 2022, 15:08

added 8 commits

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 14, 2022, 15:45

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

je pense que ce genre de message doit etre repeté un peu partout dans le code. Est ce que tu peux voir pour trouver les doublons ?

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 14, 2022, 15:50

Commented on internal/service/util.go line 289

Je ne sais pas quoi mettre comme parametre pour le formattage. Il n'y en avait pas avant du coup j'ai juste mis un string vide.

benoitdm-oslandia commented 1 year ago

tu ne mets rien et ca devrait passer

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 14, 2022, 15:55

Commented on internal/service/util.go line 289

Les tests passent mais j'ai quand même ce message de warning dans VSCode

var err error
github.com/CrunchyData/pg_featureserv/internal/service.appErrorInternal format %v reads arg #1, but call has 0 argsprintf
benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 14, 2022, 15:57

Commented on internal/service/handler.go line 342

changed this line in version 5 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 14, 2022, 15:57

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 14, 2022, 15:58

marked this merge request as ready

benoitdm-oslandia commented 1 year ago

ahh bah oui: la const api.ErrMsgDataWriteError contient un %v donc tu dois mettre un parametre

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 14, 2022, 15:59

J'ai fait une passe sur les autres appel à appErrorInternal

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 14, 2022, 16:04

Commented on internal/service/handler.go line 342

J'ai ajouté la const ErrMsgCollectionRequestBodyRead

benoitdm-oslandia commented 1 year ago

ok

benoitdm-oslandia commented 1 year ago

hum ... pareil avec celui là ? :innocent:

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 14, 2022, 16:09

Commented on internal/service/handler.go line 327

OK mais je vais jamais réussi à faire merger ma MR si ca continue :smile:

benoitdm-oslandia commented 1 year ago

mais si mais si

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 14, 2022, 16:11

Commented on internal/service/handler.go line 327

changed this line in version 6 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 14, 2022, 16:11

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 14, 2022, 16:11

Commented on internal/service/handler.go line 327

done

benoitdm-oslandia commented 1 year ago

approved this merge request

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 14, 2022, 16:20

approved this merge request

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 14, 2022, 16:36

approved this merge request

benoitdm-oslandia commented 1 year ago

In GitLab by @jmkerloch on Oct 17, 2022, 15:58

resolved all threads