flask-smorest icon indicating copy to clipboard operation
flask-smorest copied to clipboard

Add descriptions to PaginationMetadataSchema

Open DashKenny opened this issue 3 years ago • 2 comments

When upgrading a service to [email protected], it came with upgrading to [email protected]. Then, when running our openapi linting step, the following came up:

+ flask openapi write openapi.json     
+ spectral lint openapi.json --fail-severity=warn                                                                                                                
OpenAPI 3.x detected                                                                                                                                             
                                                                                                                                                                 
<...>/openapi.json                                                                                                                 
 2218:28  warning  oas3-unused-components-schema  Potentially unused components schema has been detected.  components.schemas.PaginationMetadata                 
 2221:19    error  property-description           Property must have a description.                        components.schemas.PaginationMetadata.properties.total
 2224:25    error  property-description           Property must have a description.                        components.schemas.PaginationMetadata.properties.total
_pages                                                                                                                                                           
 2227:24    error  property-description           Property must have a description.                        components.schemas.PaginationMetadata.properties.first
_page                                                                                                                                                            
 2230:23    error  property-description           Property must have a description.                        components.schemas.PaginationMetadata.properties.last_
page                                                                                                                                                             
 2233:18    error  property-description           Property must have a description.                        components.schemas.PaginationMetadata.properties.page 
 2236:27    error  property-description           Property must have a description.                        components.schemas.PaginationMetadata.properties.previ
ous_page                                                                                                                                                         
 2239:23    error  property-description           Property must have a description.                        components.schemas.PaginationMetadata.properties.next_
page                                                                                                                                                             
                                                                                                                                                                 
✖ 8 problems (7 errors, 1 warning, 0 infos, 0 hints)

I think the fix is simple and just requires adding a metadata['description'] to the fields here. This is also happening because we enforce having a description on our open api fields. Seems it would be a harmless update so I can put up a PR later probably, just wanted to log this and see what others think. I can also just ignore the error in the mean time :)

DashKenny avatar Aug 05 '22 13:08 DashKenny

Tried creating a PR but got some permission issues. I did follow along with CONTRIBUTING.rst as well.

DashKenny avatar Aug 05 '22 16:08 DashKenny

Hi.

You may send a PR with field description.

You shouldn't have permission issues creating a PR.

lafrech avatar Oct 16 '22 20:10 lafrech