Coder Social home page Coder Social logo

ziapi's Introduction

Hi there 👋

country GitHub followers

French student at {EPITECH} Paris

Languages and Tools

ziapi's People

Contributors

antwxne avatar arthurvasseur avatar breigner01 avatar chch270 avatar edouard-sn avatar gfaim avatar martin-olivier avatar rojas-diego avatar romain-1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ziapi's Issues

My Bug Report

Description

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

How to get out of pipeline when a module fail (or need to throw)?

Description

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.

Proposed solution

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) :)

Warning on windows

[BUG] Warning on windows

Description

When compiling , a lot of warning C4458 appear due of same member name, and function parameters name.

Your environment

  • OS: Windows
  • Environement: Visual Studio 2019 (occure on higher version)
  • Branch: main

Steps to reproduce

Warning appear at compilation time.

Expected behaviour

No warning should appear.

Actual behaviour

6 warning C4458 appear. (see Logs)

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'

Proposed solution

Change function parameters or member name.

Typo in README

[BUG] [Typo in README]

Description

There is a typo in the README

Your environment

  • OS and version: doesn't matter
  • branch that causes this issue: main

Steps to reproduce

  • Read the README

Expected behaviour

No typo in README

Actual behaviour

There is a typo

Logs

None

Proposed solution

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`:

Memory safe config implementation

Description

The implementation of the ziapi::config::Node potentially leaks memory through the use of raw pointers.

Describe the solution you'd like

The raw pointers used inside the ziapi::config::Dict and ziapi::config::Dict type aliases should be replaced by std::shared_ptr.

[FEATURES] [Modify Pop() function prototype of IResponseInputQueue]

[FEATURES] [Modify Pop() function prototype of IResponseInputQueue]

Description

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.

Describe the solution you'd like

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
 }

DELETE key word already used

[BUG] DELETE key word already used

MSVC already define DELETE (winnt.h:8943) and in HttpConstants.hpp:10, you try to modifie is value.

Your environment

  • OS: Windows
  • Environement: Visual Studio 2019 (occure on higher version)
  • Branch: main

Steps to reproduce

Error occur at compilation time.

Expected behaviour

Compilete should end with no error.

Actual behaviour

Compilation end with an error (see Logs)

Logs

\ziapi-prefix\src\ziapi\include\ziapi\HttpConstants.hpp(10,16): error C2059:  erreur de syntaxe : 'constante'

Proposed solution

Change the name of ziapi::http::method::DELETE to ziapi::http::method::delete or any other key word.

GetCompatibleApiVersion does not match the versioning system of the API

Description

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.

Your environment

  • main branch

Expected behaviour

I 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).

Proposed solution

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

Returning references with AsString method

Description

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.

Is your feature request related to a problem? Please describe.

I'm frustrated because I can't return const references with my configuration because it's causing a warning during compilation.

Describe the solution you'd like

Return references or const references.

Bad type in IResponseInputQueue::Pop

Description

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;
};

Expected behaviour

it should return a Response

Proposed solution

class IResponseInputQueue {
public:
    virtual ~IResponseInputQueue() = default;

    virtual std::pair<Response, Context> Pop() = 0;

    [[nodiscard]] virtual std::size_t Size() const noexcept = 0;
};

Universal references forwarding

[FEATURES] Add usage of perfect forwarding for universal references

Description

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 ?

Your environment

Useless for this issue

  • OS and version
    Useless for this issue
  • branch that causes this issue
    main

Is your feature request related to a problem? Please describe.

No universal references

    template <typename... Args>
    Node(Args &&...args) : std::variant<Undefined, Null, bool, int, double, String, Array, Dict>(args...){};

Describe the solution you'd like

    template <typename... Args>
    Node(Args &&...args) : std::variant<Undefined, Null, bool, int, double, String, Array, Dict>(std::forward<Args>(args)...){};

String as key in http context

[BUG] on peut mettre n'importe quoi comme key

Description

"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

Compilation warnings in Http.hpp

Description

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++]

Your environment

  • OS and version: PopOs (v 21.10)
  • branch that causes this issue: main

Steps to reproduce

Use -Wall -Wextra -Weffc++ compilation flags.

Warnings are located in Http.hpp lines 16 and 33.

wait method on queues

Description

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).

Is your feature request related to a problem? Please describe.

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.

Describe the solution you'd like

The wait method i've explained upper.

Error in documentation (Http.hpp line 74)

[BUG] [Error in documentation]

Small error in documentation in Http.hpp line 74

Description

The documentation line 74 about IRequestOutputQueue talks about responses 🙃

Expected behaviour

It should talk about requests 🙃

Proposed solution

Fix the documentation

Creating Dict from a Node struct

Description

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>)’

Your environment

  • OS and version: PopOS 21.10
  • branch that causes this issue: main

Steps to reproduce

Use the code I give has example

Proposed solution

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>>.

Replace the lists of variables in HttpConstants with enum class

[FEATURES] Replace the lists of variables in HttpConstants with enum class

Description

The lists of variables that are used as number can and should be replaced by enum class.

Is your feature request related to a problem? Please describe.

Nope

Describe the solution you'd like

Replace the lists that can be by enum class

Expected behaviour

Same

Actual behaviour

Same

Logs

None

Additional context

None

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.