Giter Site home page Giter Site logo

Comments (5)

marina-p avatar marina-p commented on July 26, 2024

@rifiles @PatGod Please review the above design and let me know if you see any gaps/issues.

from restler-fuzzer.

PatGod avatar PatGod commented on July 26, 2024

@marina-p Thanks, makes sense. Should this be a Swagger annotation (as suggested above) or could this be implemented simply as a new dictionary command?
In other words, does this feature impact the compiler? (If yes, then it should be a new Swagger annotation, otherwise it could/should be a new dictionary option -- OK?)

from restler-fuzzer.

marina-p avatar marina-p commented on July 26, 2024

@PatGod Yes, the compiler needs to be updated, because there is no concept of "property name/path" in the grammar today for the user to specify these only to the engine.

As a separate point, these could be specified in the dictionary (and analyzed by the compiler, similar to restler_custom_payload) instead of an annotation, but it's a bit cumbersome because they are on a per request basis, so they actually need to go into the engine settings per_resource_settings as an inline dictionary. If we supported per-resource settings in the dictionary itself, I think it could go in either dictionary or annotations (and would be easy to support the dictionary case later if we want to add it).

from restler-fuzzer.

marina-p avatar marina-p commented on July 26, 2024

@rifiles @PatGod Here's what the dictionary could look like with support for per-resource settings:

  "restler_custom_payload_uuid4_suffix": {
    "resourceId": "resourceprefix",
    "/resource/id": "resourceprefix"
  },
  "per_resource_settings": {
    "/v1/resources/{resourceId}": {
      "put": {
        "equal_resource_ids":  ["resourceId", "/resource/id"]
      }
    }
  }

from restler-fuzzer.

rifiles avatar rifiles commented on July 26, 2024

@marina-p

For uuid4 suffix values, the desired behavior already exists in the engine, I believe, without the need for any changes.

If the same uuid4_suffix key is specified in a request, the same value is duplicated each time it's specified in that request.

For instance, in the below scenario, the houseName value in the endpoint and the houseName value in the body will both be the same (example: house1234 and "house1234")

request = requests.Request([
    primitives.restler_static_string("PUT "),
    primitives.restler_static_string("/"),
    primitives.restler_static_string("city"),
    primitives.restler_static_string("/"),
    primitives.restler_static_string(_city_put_name.reader()),
    primitives.restler_static_string("/"),
    primitives.restler_static_string("house"),
    primitives.restler_static_string("/"),
    primitives.restler_custom_payload_uuid4_suffix("houseName"),
    primitives.restler_static_string(" HTTP/1.1\r\n"),
    primitives.restler_static_string("Accept: application/json\r\n"),
    primitives.restler_static_string("Host: restler.unit.test.server.com\r\n"),
    primitives.restler_static_string("Content-Type: application/json\r\n"),
    primitives.restler_static_string("\r\n"),
    primitives.restler_static_string("{"),
    primitives.restler_static_string('"house":'),
    primitives.restler_custom_payload_uuid4_suffix("houseName", quoted=True),
    primitives.restler_static_string("}"),
    primitives.restler_refreshable_authentication_token("authentication_token_tag"),
    primitives.restler_static_string("\r\n"),
    {
        'post_send':
        {
            'parser': parse_cityHouseNamePut,
            'dependencies':
            [
                _city_house_put_name.writer()
            ]
        }
    },

The compiler should only need to specify primitives.restler_custom_payload_uuid4_suffix with the same key in multiple places to apply the copied string logic in the engine - no need for an additional id lookup.

However, there is a small bug in the dynamic primitive resolution that needs to be fixed - it currently isn't handling the quoted parameter properly.

from restler-fuzzer.

Related Issues (20)

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.