rest-guide icon indicating copy to clipboard operation
rest-guide copied to clipboard

Add rule for description and summary

Open jpraet opened this issue 2 years ago • 6 comments

Should there be a rule for description, summary, title of operations/schemas/other? Start with upper case and end with a period (.)

  • https://support.smartbear.com/swaggerhub/docs/en/manage-resource-access/api-standardization.html#UUID-a3ec554d-e289-65b4-198a-7c68403402d4_id_summary-format
  • https://github.com/Azure/azure-openapi-validator/issues/59

In the belgif types it's not very consistent:

https://github.com/belgif/openapi-problem/blob/2caf79a89d933d01d222046724ca0698d775cd53/src/main/openapi/problem/v1/problem-v1.yaml#L17

https://github.com/belgif/openapi-problem/blob/2caf79a89d933d01d222046724ca0698d775cd53/src/main/openapi/problem/v1/problem-v1.yaml#L23

https://github.com/belgif/openapi-problem/blob/2caf79a89d933d01d222046724ca0698d775cd53/src/main/openapi/problem/v1/problem-v1.yaml#L45

jpraet avatar Nov 22 '23 07:11 jpraet

title for Schemas should probably be avoided, because they override the Schema name in the SwaggerUI view

pvdbosch avatar Nov 22 '23 13:11 pvdbosch

there's already a rule for description (and avoid title) on schemas: [oas-descr]

I'll check if absence of title property is verified by the validator

pvdbosch avatar Nov 30 '23 15:11 pvdbosch

Absence of title property is added in new release of validator >= 1.3.0 (though validator not yet open-sourced)

pvdbosch avatar Jan 22 '24 13:01 pvdbosch

Maybe we should discourage putting summary and description on path level instead of operation level.

The spec https://spec.openapis.org/oas/v3.0.3#path-item-object states that summary and description on path level are intended to apply to all operations in the path.

But swagger-ui does not render them (https://github.com/swagger-api/swagger-ui/issues/5653), not even as a fallback when the summary or description on operation level are absent.

I think it's also more logical in general to put the summary and description on operation level.

jpraet avatar Feb 28 '24 08:02 jpraet

Personally, I prefer start with a capital letter, but a period seems unnecessary for single-line summaries.

It might not be worthwhile to enforce such guidelines very strictly. It could represent more work than gain depending on the context of the API. There are always some exceptions that should be allowed (e.g. description: "eHealth-ID of software package"). It would be interesting if the validator would support configurable rule sets for such cases.

pvdbosch avatar May 29 '24 08:05 pvdbosch