Nested structured search is Sourcegraph?

123 views Asked by At

I would like to search Java annotations with another annotations inside. I don't know how many nested levels there are or I don't want to specify it. Finally, I would like to search for examples of @ApiImplicitParams with param type body and with @Example annotations inside.

But first I am trying to match anything nested.

First I searched for

@ApiImplicitParams(...)

and it found me somethind. The very first result is

@ApiImplicitParams({ @ApiImplicitParam(name = "foo", value = "List of strings", paramType = "body", dataType = "Foo") })

and has @ApiImplicitParam inside. Let's try to match it.

I tried

@ApiImplicitParams({@ApiImplicitParam(...) ...})

but it didn't find that case with one nesting and didn't find any cases with multiple @ApiImplicitParams inside.

How to accomplish?

1

There are 1 answers

0
Warren Gifford On

Finally, I would like to search for examples of @ApiImplicitParams with param type body and with @Example annotations inside.

I believe the following query will meet your requirements here. @ApiImplicitParams({...@ApiImplicitParam(...paramType = "body"...)...}) lang:Java

Some examples of matches --

    @ResponseBody
    @ApiImplicitParams({ @ApiImplicitParam(name = "foo", value = "List of strings", paramType = "body", dataType = "Foo") })
    public Foo create(@RequestBody final Foo foo) {
      nickname = "setLoggingSettings")
  @ApiImplicitParams({
    @ApiImplicitParam(
        name = "Logging Config",
        value = "Logging config to be updated",
        required = true,
        dataType = "com.yugabyte.yw.forms.PlatformLoggingConfig",
        paramType = "body")
  })
  public Result setLoggingSettings() throws JoranException {

A note on this --

I don't know how many nested levels there are or I don't want to specify it.

The query provided above assumes one nested block, I'm afraid right now Sourcegraph doesn't have a good way to express an arbitrary level of nesting.

Hope that helps!