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

Update readme inputformat v2 #6

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

AminJELLADParticeep
Copy link
Contributor

J'améliore le readme au regard de ma discussion avec le prestataire.

README.md Outdated
request: NewPricerQuoteRequest,
config: NewPricerConfig
): Future[Fail \/ PricerResponse] = {
request: NewPricerQuoteRequest,
Copy link
Contributor

Choose a reason for hiding this comment

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

pourquoi tu changes tous les espaces ? le code était bien formaté

Copy link
Contributor Author

Choose a reason for hiding this comment

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

je ne sais pas si c'est scalafmt ou mon iDE qui fait ça, sur ton ide il y a un formattage automatique ?

README.md Outdated

```scala
All the data you are going to receive comes from an external server, let's call X.
Copy link
Contributor

Choose a reason for hiding this comment

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

let's call X ===> let's call it X

Copy link
Contributor Author

Choose a reason for hiding this comment

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

je corrige.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

je corrige.

README.md Outdated
```scala
All the data you are going to receive comes from an external server, let's call X.
The purpose of X is to provide you with the classes you need with data in your implementation. For this he will send you the classes
depending on how you defined the input format.
Copy link
Contributor

Choose a reason for hiding this comment

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

Le serveur X n'envoie pas les classes, on fait du RPC ou autres

Le serveur X envoie du json
L'input format correspond a un format de validation de json et non de classes Java / Scala

Copy link
Contributor Author

@AminJELLADParticeep AminJELLADParticeep Aug 25, 2022

Choose a reason for hiding this comment

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

La phrase est mal formulée.
Je tente de faire comprendre que le serveur X envoie une représentation de la classe définie par le développeur au format JSON.

voilà la nouvelle phrase :
the purpose of the server x is to send you the JSON-formatted representation of your classes.
Therefore, it will suffice to use play json to transform the JSON into the format of the expected class

README.md Outdated
The purpose of X is to provide you with the classes you need with data in your implementation. For this he will send you the classes
depending on how you defined the input format.

Server X does not just send this, it sends you the data from the pricing (quote) in order to reuse it if necessary for the context transfer (select)
Copy link
Contributor

Choose a reason for hiding this comment

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

j'ai pas compris ce que tu veux dire ici

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On reçoit les données de la tarification quand on est dans le transfert de contexte.

Copy link
Contributor

Choose a reason for hiding this comment

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

Dans ce cas là supprimes les 10 lignes et dit le simplement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

README.md Outdated

As mentioned above, you are not going to dialogue with the X server, to check the input_format you can ask a developer on slack or show it during your pull request
Copy link
Contributor

@Driox Driox Aug 24, 2022

Choose a reason for hiding this comment

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

Surtout pas : on veut pas vérifier l'input format a la main, il peut faire un test unitaire qui utilise la méthode SchemaOperation.validate

et vérifier que son input format valide bien le json correctement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SchemaOperation.validate n'existe pas dans pricer intégration. Tu as introduit cela dans ton meta pricer. Il faudrait dans un premier temps qu'on se forme sur ça et ensuite l'intégrer sur pricer intégration.

et vérifier que son input format valide bien le json correctement
cela pourrait être une solution. Je l'intègre dans le texte à défaut de ne pas avoir une alternative.

README.md Outdated

As mentioned above, you are not going to dialogue with the X server, to check the input_format you can ask a developer on slack or show it during your pull request

For now Server X will send you Json data.
Copy link
Contributor

Choose a reason for hiding this comment

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

a supprimer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, mais pourquoi ?

README.md Outdated

For now Server X will send you Json data.
## Basic structure
Definition of input format is defined in module "domain" :
Copy link
Contributor

Choose a reason for hiding this comment

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

Definition of input format is defined in module "domain" :

==>

Input format is defined in module "domain"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok je change

README.md Outdated
@@ -111,7 +122,20 @@ NB 1: if `is_array` is true, then the json type is an array and the elements of
NB 2: if `is_array` is false and `multiple` is true then this is the case where it creates a checkbox, and fields defined by data in the "option" attribute.

## Sample Code
Let's see an example. We are going to create a class then we will see its translation into an input format, basically how
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's see an example. We are going to create a class then we will see its translation into an input format, basically how the X server will send you the data in Json format

==>

Il faut expliquer la logique : on reçoit du json en input dans le ctrl ensuite on le valide avec InputFormat ensuite on parse en case class "si besoin"

Le serveur X n'apporte pas grand chose ici
Et partir de la case class indique une mauvaise direction

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Je n'ai pas compris.
Il faut expliquer la logique : on reçoit du json en input dans le ctrl
là je comprends, je suppose en passant que ctrl veut dire controller ici

ensuite on le valide avec InputFormat
valider avec InputFormat ? là j'ai pas compris

ensuite on parse en case class "si besoin"
ok ça c'est j'ai compris

Copy link
Contributor

Choose a reason for hiding this comment

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

oui ctrl = controller

ensuite on le valide avec InputFormat
Ca veut dire appeler SchemaOperation.validate pour verifier que le json correspond bien au schema décrit par InputFormat

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok mais on est bien d'accord que SchemaOperation n'existe point sur pricer intégration ? C'est une notion apparue avec le meta pricer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Bien sur, dans pricer integration on n'a pas besoin d'appeler SchemaOperation.validate

C'est fait de facon transparente

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok 👍

README.md Outdated
@@ -153,6 +177,27 @@ private[this] def smoker_format: InputFormat = {
}

```
when the server X sends you data, it will be in json. If the input format matches the class cases you created, doing a json.as should work
Copy link
Contributor

Choose a reason for hiding this comment

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

A reformuler

  • retirer les mentions au serveur X
  • on fait jamais de .as sur du json : on doit vaire du .validate
  • les erreurs de syntaxe, class cases --> case class

Copy link
Contributor Author

@AminJELLADParticeep AminJELLADParticeep Aug 25, 2022

Choose a reason for hiding this comment

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

tu veux retirer les mentions au serveur x dans la ligne que tu as pointée ou dans tout le readme ? Si oui pourquoi ?
Pour le .as je vais changer l'exemple.
Pour la syntaxe je corrige.

README.md Outdated

val data_parser : Data = data_from_server_x.as[Data]
````
this is an example, actually you are not allowed to use ".as" because of side effects, you should use ".validate" with Sorus.
Copy link
Contributor

Choose a reason for hiding this comment

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

faut jamais montrer qlc d'interdit dans une doc
faut partir du principe que les gens vont lire la doc a moitier

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok comme dit au dessus (ou en dessous si tu lis ça par mail) je change ça.


As mentioned above, you are not going to dialogue with the server X, to check the input_format you have to do a unit test that takes a json as input
and sees if by transforming the json into the expected class there is no problem
Copy link
Contributor

Choose a reason for hiding this comment

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

Le commentaire a sauté mais reste vrai : il faut enlever tout ce paragraphe, ca donne des infos peu clair qui vont embrouiller les gens

## how does it work ?
You can see input format like a schema and not a function. What you put in define a case class. This schema is parsed by another application, and you do not have to think about it.
For your perimeter you just have to translate into input format your case class. Case class you have to transform into input format are case class for quote and case class for select.

All the data you are going to receive comes from an external server, let's call it X.
the purpose of the server X is to send you the JSON-formatted representation of your classes. 
Therefore, it will suffice to use play json to transform the JSON into the format of the expected class  
For this, it will send you the JSON depending on how you defined the input format.

Note : Server X will always send you all input you need to implement quote and select. It includes your input format for quote, select and external data if you defined one.

As mentioned above, you are not going to dialogue with the server X, to check the input_format you have to do a unit test that takes a json as input 
and sees if by transforming the json into the expected class there is no problem

Tu peux remplacer par qlc de simple

### How does it works ? --  peut etre revoir le titre

InputFormat is a schema that describe the json you receive. 
It's like [json-schema](https://json-schema.org/) but much simpler. 
The json in input will be validated with the inputFormat you define, this happends in another part of the application that is outside the scope of your work

} ]
}
```
This input correspond to this input format :
Copy link
Contributor

Choose a reason for hiding this comment

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

This input will be validated in success with this input format

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.

None yet

2 participants