Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endpoint to transform a dataRelationShip in DDI to Json #95

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

JeromeMBourgeois
Copy link
Contributor

transform the ddi2vtlJson endpoint into ddiDataRelationShiptoJson

Copy link
Member

@FBibonne FBibonne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dans le controller :

  • factoriser le code entre ddi2vtl et ddi2vtlBrut
  • renommer correctement la méthode Derefddi
  • Les blocs catch(Exception e){ throw new VtlTransformationException(...); } sont inutiles
  • Il me semble cohérent de retourner une 400 en cas de XsltTransformationExcpeiton (encapsule une saxonException) car c'est un pb du xml (on peut retourner le message dans le body) et une 500 pour l'IO exception (sans body)

Tester le xslt


// Retourner la liste sous forme de JSON
return ResponseEntity.ok()
.contentType(MediaType.APPLICATION_JSON)
.body(outputText);
.body(cleanJson);
} catch (IOException e) {
throw new VtlTransformationException(FAILED_TO_PROCESS_THE_INPUT_FILE + ".", e);
} catch (XsltTransformationException e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En cas d'erreur de transfo, on ne devrait pas renvoyer une 400 avec la cause de l'erreur, c'est parce que l'entrée utilisateur est mauvaise que l'entrée se produit, non ?


// Retourner la liste sous forme de JSON
return ResponseEntity.ok()
.contentType(MediaType.APPLICATION_JSON)
.body(outputText);
.body(cleanJson);
} catch (IOException e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inutile : renvoyer directement la 500 dans le catch IOException

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants