opa icon indicating copy to clipboard operation
opa copied to clipboard

AST: Inconsistent casing of location in serialized comment nodes

Open anderseknert opened this issue 2 years ago • 4 comments
trafficstars

When serialized, comment nodes display the location and text attributes as Location and Text. This is inconsistent with how those attributes are presented anywhere else in the AST (where they are lowercased), and it would be good to have that fixed.

package p

# foo bar
opa parse --format json p.rego
{
  "package": {
    "path": [
      {
        "type": "var",
        "value": "data"
      },
      {
        "type": "string",
        "value": "p"
      }
    ]
  },
  "comments": [
    {
      "Text": "IGZvbyBiYXI=",
      "Location": {
        "file": "c.rego",
        "row": 3,
        "col": 1
      }
    }
  ]
}

anderseknert avatar Sep 29 '23 08:09 anderseknert

Hello @anderseknert . I would like to contribute to this bug, can you please assigned this issue to me?

prashant3286 avatar Oct 17 '23 05:10 prashant3286

Hi @prashant3286! And thank you for offering to help! The issues that are tagged 1.0 are a little special compared to other issues, as they are breaking changes that can't be included in our monthly releases. That means special care will need to be taken either to guard these features behind feature flags, or simply delay them until the 1.0 release. In this case, I'm not sure it'd be feasible to change serialization format based on a feature flag, so I'll defer this to @johanfylling and @ashutosh-narkar, who are leading the 1.0 effort.

anderseknert avatar Oct 17 '23 07:10 anderseknert

Sure. Please let me know if the breaking changes will be implemented soon so that I could contribute to the other issue. Also please suggest me some bug which needs to be fixed asap.

prashant3286 avatar Oct 17 '23 07:10 prashant3286

Starting out with one of the issues marked as "good first issue" is a good way to get your feet wet before going after bigger fish :)

anderseknert avatar Oct 17 '23 09:10 anderseknert

Not much point in keeping this open since it isn't included for 1.0. Closing.

anderseknert avatar Jun 10 '24 22:06 anderseknert