Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridge does not support all valid Markdown list formats #1935

Closed
VenelinMartinov opened this issue May 8, 2024 · 3 comments · Fixed by #2006
Closed

Bridge does not support all valid Markdown list formats #1935

VenelinMartinov opened this issue May 8, 2024 · 3 comments · Fixed by #2006
Assignees
Labels
area/docs Improvements or additions to docs for this repo area/docsgen Issues with docs capture or example rendering, historically part of pkg/tfgen kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@VenelinMartinov
Copy link
Contributor

What happened?

For pulumi/pulumi-pagerduty#477 we noticed that we were picking up the wrong input description for a page with multiple inputs called "type".

After #1882 all the input descriptions have the output "type" description instead.

We've also lost a bunch of valid descriptions: https://www.pulumi.com/registry/packages/pagerduty/api-docs/service/#inputs - this is mostly empty.

Example

Upgrade diff: https://github.com/pulumi/pulumi-pagerduty/pull/476/files#diff-802c5dcd29dd2017fa41e8ba4cf0ede0e40d0176433bb47721c7cd87d812f10b

Output of pulumi about

.

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@VenelinMartinov VenelinMartinov added needs-triage Needs attention from the triage team kind/bug Some behavior is incorrect or out of spec labels May 8, 2024
@guineveresaenger
Copy link
Contributor

I seem to remember that picking up output types is currently a fallback behavior when docs cannot otherwise be found. We may want to revisit that design.

As for the pagerduty issue, there's two things we should look into

  1. there's a bug in top-level argument reference detection --> fix here in bridge
  2. because the nested block subsections in this resource have a lot of chitchat, they are not discovered properly.
    --> provider-level fix: we can try to add a docsEditRule
    --> bridge fix: adjust the regex

@VenelinMartinov VenelinMartinov added area/docs Improvements or additions to docs for this repo area/docsgen Issues with docs capture or example rendering, historically part of pkg/tfgen and removed needs-triage Needs attention from the triage team labels May 10, 2024
@guineveresaenger
Copy link
Contributor

guineveresaenger commented May 16, 2024

Next data point:

Unlike all other providers, this particular provider adds spurious indents to its Argument Reference

From pagerduty.Service:

## Argument Reference

The following arguments are supported:

  * `name` - (Required) The name of the service.
  * `description` - (Optional) A human-friendly description of the service.

Compare to aws.AccountRegion:

## Argument Reference

This resource supports the following arguments:

* `enabled` - (Required) Whether the region is enabled.
* `region_name` - (Required) The region name to manage.

We rely on indents to discover nested docs paths.

Additionally the resource description cited in the original issue has...verbose titles for the nested blocks which we don't discover in the bridge.

@guineveresaenger guineveresaenger changed the title Docs descriptions are picking up output descriptions for input types Bridge does not support all valid Markdown list formats May 21, 2024
@guineveresaenger
Copy link
Contributor

guineveresaenger commented May 21, 2024

So, the real fix for this issue is to make the abovementioned list indent, which is legal in GitHub flavored Markdown, be correctly handled by docs parsing.

Falling back on output descriptions is a current necessary reality in larger providers such as AWS, where Inputs/Outputs overlap quite frequently but often only one is documented, so that part works as expected - the bug is that the fallback condition should never have gotten triggered for Pagerduty.

guineveresaenger added a commit that referenced this issue May 22, 2024
This pull request adds recursive parsing for nested lists in upstream
docs of the format.

```
* `rules` - (Required) Collection of real time alert rules
  * `type` - (Required) Rule type.
  * `issue_detection_configuration` - (Optional) Configuration for an issue detection rule.
    * `rule_name` - (Required) Rule name.
      * `spec` - A spec for the issue detection configuration rule name.
```

Due to looking at the index of the bullet point list marker in each such
line, this addresses the bug underlying #1935 where blank space in front
of a top-level list item is permitted in Markdown, as in this example:
```
## Argument Reference

The following arguments are supported:

  * `name` - (Required) The name of the service.
  * `description` - (Optional) A human-friendly description of the service.
```

Please see the schema diff for docs descriptions for pulumi-pagerduty:
https://github.com/pulumi/pulumi-pagerduty/compare/guin/sample-docsgen?expand=1

Fixes #1935.
Partial fix for pulumi/pulumi-pagerduty#477.
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs Improvements or additions to docs for this repo area/docsgen Issues with docs capture or example rendering, historically part of pkg/tfgen kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants