Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-10040

Declare constraints on Web Service parameters

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.0
    • Component/s: Web API

      Description

      Regularly, there are bugs spotted on the length of a parameter or the maximum value of a numeric.
      The goal is to reduce the probability to have this type of bug in the future.

      Constraints on a parameter should be declared at the same time as the parameter and checked automatically by the WS engine.

      Two new fields have been added in the web API :

      • maximumLength : Maximum length of a string value (multi-values are not impacted)
      • maximumValue : Maximum value for a numeric value

      Here are some examples :

      • api/metrics/create :
        {
            "key": "key",
            "description": "Key",
            "maximumLength": 64
        }
        

        *api/permissions/users :

        {
            "key": "ps",
            "description": "Page size. Must be greater than 0 and less than 100",
            "maximumValue": 100
        }
        

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gregoire.aubert Gregoire Aubert
              Reporter:
              teryk.bellahsene Teryk Bellahsene
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: