Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Arul
    @Arul-
    let me explain the solution for your problem
    Martin Goyot
    @Erwyn
    if i put <item> instead of <values> yes I have:
    array (
        '0' => array (
            'some-property' => 123
        )
    )
    Arul
    @Arul-
    XmlFormat needs to know which tag it has to consider as numeric index, by default it is item you can change it by adding
    Martin Goyot
    @Erwyn
    but if I put @param array $item then it is the contrary, values works and not item
    oh no you're right, it works
    in RC6
    the problem appeared in RC4
    I'm listening to you though :p
    Arul
    @Arul-
    use Luracast\Restler\Format\XmlFormat;
    
    XmlFormat::$defaultTagName = 'values';
    you can place it in your index.php
    or if each of your api needs different default tag, you can also do the following
    //make sure you add a use statement on top
    use Luracast\Restler\Format\XmlFormat;
    
    //in your api class add the method with a @class comment
    /**
     * test post
     *
     * @url POST {id}
     * @param int $id   Id of the artifact {@from body}
     * @param array  $values    Artifact fields values {@from body}
     *
     * @return int
     *
     * @class XmlFormat {@defaultTagName values}
     */
    protected function post($id, array $values) {
        var_dump($values);
        return 4;
    }
    Martin Goyot
    @Erwyn
    mhhh
    and If I need multiple defaultTagNames? to match the JSON API? is this something possible
    Arul
    @Arul-
    nope not at the moment
    Martin Goyot
    @Erwyn
    okay
    Arul
    @Arul-
    if you present a good and common use case in the same issue (#410) I can consider adding that ;)
    Martin Goyot
    @Erwyn
    haha, would be great :)
    Martin Goyot
    @Erwyn
    no, I have to run some further testing to see if it is really necessary
    Arul
    @Arul-
    sure, go ahead and keep me posted!
    Martin Goyot
    @Erwyn
    just to be sure, it seems that there is another big difference between RC4 and RC6. All @param that are not tagged as {@required false} seems to be considered as required. Am I doing something wrong? Is this configurable somehow?
    Arul
    @Arul-
    if a function parameter has a default value, and is placed after all the required parameters, it is considered as optional
    Martin Goyot
    @Erwyn
    okay, I take good note, and my last question of the day (sorry for bothering you so much today)
    Arul
    @Arul-
    for some reason if you want to override that, you can set {@required} to mark it as required or {@required false} to mark it as optional. When you force a required parameter as optional that method will receive null for that parameter when omitted by the api user
    Martin Goyot
    @Erwyn
    i Have something like this for a route:
    * @param array  $values    Artifact fields values {@from body} {@type \Tuleap\Tracker\REST\v1\ArtifactPOSTValues}
    Arul
    @Arul-
    ok
    Martin Goyot
    @Erwyn
    and the ArtifactPostValues being something like:
    class ArtifactPOSTValues {
    
        /**
         * @var int {@type int} {@required true}
         */
        public $field_id;
    
        /**
         * @var mixed {@require false}
         */
        public $value;
    }
    Arul
    @Arul-
    ok
    Martin Goyot
    @Erwyn
    on RC4 I would have correctly filled objects, but with the RC6, field_id and value are both null (at least using XML, I'll try with JSON)
    ah, and set {@type mixed} ?
    Arul
    @Arul-
    your definition means that you are expecting an array of ArtifactPOSTValues object
    Martin Goyot
    @Erwyn
    yes
    Arul
    @Arul-
    I haven’t tested it with xml lately but it should work
    Check with JSON and file a bug if not consistent
    it is past mid-night in Singapore (1:20am) Will catch you tomorrow
    Martin Goyot
    @Erwyn
    oh sorry, I'm in France
    Have a good night
    Martin Goyot
    @Erwyn
    So, we'll discuss this tomorow, but it does not work in JSON api neither so they are consistent. It may probably come from something we are doing wrong on our side.
    Martin Goyot
    @Erwyn
    Hello
    The casts works, I made a mistake yesterday, my bad
    Arul
    @Arul-
    oh ok
    Martin Goyot
    @Erwyn
    Hello!
    I have a question regarding authentication classes

    I have this:

    $restler->addAuthenticationClass('\\Tuleap\\REST\\TokenAuthentication');
    $restler->addAuthenticationClass('\\Tuleap\\REST\\BasicAuthAuthentication');

    Is there a way to say to Restler that if TokenAuthentication fails it has to fallback to the next authentication class? Or do I have to do a mixed authentication class that deals with the two authentication types?

    Arul
    @Arul-
    before the latest RC6 all authentication classes need to return true in order to access the api. Latest RC6 gets it the way you want! it will first try TokenAuthentication, if it fails it will use BasicAuthentication
    Martin Goyot
    @Erwyn
    okay it works, my bad.
    R. Cloeck
    @RemlineNL
    Can someone please let me know where i can find some sort of roadmap or tell me if swagger 2.0 is going to be implemented?
    Arul
    @Arul-
    We are working on swagger 2 implementation already, but hit some road blocks so might take while
    Anas Anjaria
    @anasanjaria
    how can I ?