French student at {EPITECH} Paris
martin-olivier / ziapi Goto Github PK
View Code? Open in Web Editor NEWThe elected Zia API for {Epitech} promo 2024 (Paris and Marseille)
Home Page: https://ziapi.vercel.app/
The elected Zia API for {Epitech} promo 2024 (Paris and Marseille)
Home Page: https://ziapi.vercel.app/
Bonjour,
J'ai remarqué une erreur inadmissible dans le fichier 'HttpConstants.hpp'.
Effectivement une coquille s'est glissée dans dans le namespace 'ziapi::http::reason'.
La constexpr auto kConflicT = " Conflict" possède un T majuscule en dernier caractère de son nom.
J'accepte de vous pardonner, si et seulement si le nom de cette constexpr est changé par kConflict. (avec un t minuscule)
Cordialement,
Login : [email protected]
Membre de : Paris
Anniversaire: 06/11/2001
Numéro de téléphone: +33 06 99 20 68 50
Localisation: 26 rue Gabriel Peri, Yerres, France (La cité de Ninho)
GPA: 2.59
I was trying to figure how to "throw" from modules when an error occur or how to handle when you need to skip some modules because client is not logged or his method (POST, GET, ...) is not allowed on our server or anything like that.
Maybe it could be cool to have a way to throw an exception from the pipeline (maybe a class), the exception could possibly be catch in the core to handle response (with status code + error message if necessary, something like that) :)
When compiling , a lot of warning C4458 appear due of same member name, and function parameters name.
Windows
Visual Studio 2019
(occure on higher version)main
Warning appear at compilation time.
No warning should appear.
6 warning C4458 appear. (see Logs
)
ziapi-prefix\src\ziapi\include\ziapi\Http.hpp(47,25): warning C4458: la déclaration de 'status_code' masque le membre de classe
ziapi-prefix\src\ziapi\include\ziapi\Http.hpp(38,10): message : voir la déclaration de 'ziapi::http::Response::status_code'
ziapi-prefix\src\ziapi\include\ziapi\Http.hpp(47,62): warning C4458: la déclaration de 'reason' masque le membre de classe
ziapi-prefix\src\ziapi\include\ziapi\Http.hpp(41,17): message : voir la déclaration de 'ziapi::http::Response::reason'
ziapi-prefix\src\ziapi\include\ziapi\Http.hpp(47,92): warning C4458: la déclaration de 'version' masque le membre de classe
ziapi-prefix\src\ziapi\include\ziapi\Http.hpp(35,13): message : voir la déclaration de 'ziapi::http::Response::version'
ziapi-prefix\src\ziapi\include\ziapi\Http.hpp(47,25): warning C4458: la déclaration de 'status_code' masque le membre de classe
ziapi-prefix\src\ziapi\include\ziapi\Http.hpp(38,10): message : voir la déclaration de 'ziapi::http::Response::status_code'
ziapi-prefix\src\ziapi\include\ziapi\Http.hpp(47,62): warning C4458: la déclaration de 'reason' masque le membre de classe
ziapi-prefix\src\ziapi\include\ziapi\Http.hpp(41,17): message : voir la déclaration de 'ziapi::http::Response::reason'
ziapi-prefix\src\ziapi\include\ziapi\Http.hpp(47,92): warning C4458: la déclaration de 'version' masque le membre de classe
\ziapi-prefix\src\ziapi\include\ziapi\Http.hpp(35,13): message : voir la déclaration de 'ziapi::http::Response::version'
Change function parameters or member name.
There is a typo in the README
No typo in README
There is a typo
None
Fix the following typo:
> :bulb: Don't forget to link with `libdl` on Unix is you use `dylib`:
> :bulb: Don't forget to link with `libdl` on Unix if you use `dylib`:
The implementation of the ziapi::config::Node
potentially leaks memory through the use of raw pointers.
The raw pointers used inside the ziapi::config::Dict
and ziapi::config::Dict
type aliases should be replaced by std::shared_ptr
.
Hard to determine if std::pair<Request, Context>
has been filled.
For example, if we implement the Pop function like this:
std::pair<Request, Context> MyResponseInputQueue::Pop()
{
if(myContainer.Size() == 0)
return {};
return myContainer.Pop();
}
If the function returns {}
, the default constructors of Request
and Context
will be called, which will make it harder to know if the std::pair
has been filled.
Change the prototype of the Pop() function with:
virtual bool Pop(std::pair<Request, Context> &req) = 0;
Now we can implement the new function :
bool MyResponseInputQueue::Pop(std::pair<ziapi::http::Request, ziapi::http::Context> &req)
{
if (myContainer.Size() == 0)
return false;
req = myContainer.Pop()
return true;
}
And use it like that :
IResponseInputQueue* networkQueue = new ...;
std::pair<ziapi::http::Request, ziapi::http::Context> req;
while (networkQueue->Pop(req) {
//process new request
}
MSVC
already define DELETE
(winnt.h:8943
) and in HttpConstants.hpp:10
, you try to modifie is value.
Windows
Visual Studio 2019
(occure on higher version)main
Error occur at compilation time.
Compilete should end with no error.
Compilation end with an error (see Logs
)
\ziapi-prefix\src\ziapi\include\ziapi\HttpConstants.hpp(10,16): error C2059: erreur de syntaxe : 'constante'
Change the name of ziapi::http::method::DELETE
to ziapi::http::method::delete
or any other key word.
The GetCompatibleApiVersion
method of the ziapi::IModule
interface does not match the versioning system of the ZIAPI. The ziapi::Version
structure uses a major / minor system while the ZIAPI uses major / minor / patch.
main
branchI should be able to return version 2.2.1
from the GetCompatibleApiVersion
but I must construct a ziapi::Version
which only takes two values (major and minor).
Update the ziapi::Version
class to include a patch
member.
Create a ziapi::http::Version
class with only a major and a minor (HTTP versions are identified only through major and minor).
Update the documentation and all the interfaces containing ziapi::Version
Why returning a copy instead of a reference in the AsString method in struct Node ?
String AsString() const { return std::get<String>(*this); }
It's a good practice to return references instead of copies.
I'm frustrated because I can't return const references with my configuration because it's causing a warning during compilation.
Return references or const references.
it returns a Request
😢
class IResponseInputQueue {
public:
virtual ~IResponseInputQueue() = default;
virtual std::pair<Request, Context> Pop() = 0;
[[nodiscard]] virtual std::size_t Size() const noexcept = 0;
};
it should return a Response
class IResponseInputQueue {
public:
virtual ~IResponseInputQueue() = default;
virtual std::pair<Response, Context> Pop() = 0;
[[nodiscard]] virtual std::size_t Size() const noexcept = 0;
};
In the Config.hpp file, line 45, you are creating a templated constructor, that takes universal references, can we add a perfect forwarding for theses ?
Useless for this issue
No universal references
template <typename... Args>
Node(Args &&...args) : std::variant<Undefined, Null, bool, int, double, String, Array, Dict>(args...){};
template <typename... Args>
Node(Args &&...args) : std::variant<Undefined, Null, bool, int, double, String, Array, Dict>(std::forward<Args>(args)...){};
"client" = structure client
mais les modules des autres groupes n'implementeront pas la value "client" sous forme de structure.
A voir si on peut pas imposer une nome / faire un enum
histoire que tout le monde utilise la meme chose
voir meme utiliser un data type comme celui du json
There are compilation warnings in the Http.hpp file :
ziapi/Http.hpp:33:8: warning: ‘ziapi::http::Response::version’ should be initialized in the member initialization list [-Weffc++]
33 | struct Response {
| ^~~~~~~~
ziapi/Http.hpp:33:8: warning: ‘ziapi::http::Response::status_code’ should be initialized in the member initialization list [-Weffc++]
ziapi/Http.hpp:33:8: warning: ‘ziapi::http::Response::reason’ should be initialized in the member initialization list [-Weffc++]
ziapi/Http.hpp:33:8: warning: ‘ziapi::http::Response::fields’ should be initialized in the member initialization list [-Weffc++]
ziapi/Http.hpp:33:8: warning: ‘ziapi::http::Response::body’ should be initialized in the member initialization list [-Weffc++]
ziapi/Http.hpp:16:8: warning: ‘ziapi::http::Request::version’ should be initialized in the member initialization list [-Weffc++]
16 | struct Request {
| ^~~~~~~
ziapi/Http.hpp:16:8: warning: ‘ziapi::http::Request::method’ should be initialized in the member initialization list [-Weffc++]
ziapi/Http.hpp:16:8: warning: ‘ziapi::http::Request::target’ should be initialized in the member initialization list [-Weffc++]
ziapi/Http.hpp:16:8: warning: ‘ziapi::http::Request::fields’ should be initialized in the member initialization list [-Weffc++]
ziapi/Http.hpp:16:8: warning: ‘ziapi::http::Request::body’ should be initialized in the member initialization list [-Weffc++]
Use -Wall -Wextra -Weffc++
compilation flags.
Warnings are located in Http.hpp lines 16 and 33.
It could be useful to add a
void wait() noexcept;
method that allow users to wait until something is pushed into queue.
The method sould just block untile something is pushed, then it automatically stops blocking (can be achieved by using a condvar for example).
I'm always frustrated when i try to wait until something is pushed into queue. I have no choice that do a loop that polls the size then yield. I think it could be pretty useful to add a wait method.
The wait method i've explained upper.
Small error in documentation in Http.hpp line 74
The documentation line 74 about IRequestOutputQueue
talks about responses 🙃
It should talk about requests 🙃
Fix the documentation
You can't create a Dict object from a Node:
ziapi::config::Node({
{parameters.first.as<std::string>(),std::make_shared<ziapi::config::Node>(parameters.second.as<std::string>())}
});
Given example:
ziapi::config::Node({
{"age", std::make_shared<ziapi::config::Node>(19)},
{"first_name", std::make_shared<ziapi::config::Node>("Charlie")},
{"last_name", std::make_shared<ziapi::config::Node>("Chou")},
{"is_sexy", std::make_shared<ziapi::config::Node>(true)}
});
This is the error g++ is giving me:
error: no matching function for call to ‘ziapi::config::Node::Node(<brace-enclosed initializer list>)’
Use the code I give has example
Change the MakeDict and MakeArray to avoid using a std::initializer_list because if the configuration is loaded at runtime then those functions are useless. Maybe using a std::vector<std::pair<std::string, ziapi::config::Node>>.
The lists of variables that are used as number can and should be replaced by enum class.
Nope
Replace the lists that can be by enum class
Same
Same
None
None
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.