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

Indicate when object property is empty #520

Conversation

andrii-balitskyi
Copy link
Contributor

No description provided.

@andrii-balitskyi andrii-balitskyi requested a review from a team as a code owner March 3, 2025 15:34
@seambot seambot requested a review from a team as a code owner March 3, 2025 15:35
@@ -35,19 +35,22 @@ Possible enum values:
{{/if}}

{{#if objectProperties}}
{{#if (eq objectProperties.length 0)}}
This object has no properties.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This object has no properties.
This resource has no properties.

Should this be "object" or "resource"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrii-balitskyi Is there an example of an object/resource that has no props? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't relate directly to a resource but to a property of a resource. Example: 5641393 (#520)

Copy link
Member

@DebbieAtSeam DebbieAtSeam Mar 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ha! Now that I saw the example that you linked, I understand. You were correct to use "object."

This is a separate question: What is the use of a property of a resource being an object with no properties? In the example that you linked, there's a result object, but it doesn't have any props, so what purpose does it serve?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not every action attempt has a result. Attempts without a result return an empty object. I'm not sure why we default to an empty object instead of a value that represents emptiness more precisely, like null. Maybe @razor-x can shed some light on this.

Copy link
Member

@razor-x razor-x Mar 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrii-balitskyi If there was a documented property (other than action_attempt.result) that was an empty object, this is likely a mistake and we could add it to the doc report.

As for action_attempt.result, it starts null, and then once the action attempt is success it resolves to a non-null (possibly empty) object. IMO this is an ok pattern, and changing it at this point might be a breaking change for some. The best justification for this I can cook up is that result is like a response, e.g., our API always returns at least a {} on a 200. For action attempts that return success, we always return at least a {} for the result (the "delayed response").

@andrii-balitskyi andrii-balitskyi merged commit 9b347f3 into main Mar 5, 2025
13 checks passed
@andrii-balitskyi andrii-balitskyi deleted the andrii/cx-248-improve-docs-for-resource-object-properties-without branch March 5, 2025 13:25
@andrii-balitskyi andrii-balitskyi self-assigned this Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants