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

feat(ResponseType): Warn about top-level lists #153

Closed
wants to merge 1 commit into from

Conversation

provokateurin
Copy link
Member

Closes #136

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

That's quite a huge list and from my POV it totally makes sense to use lists for those things.
Why would we want to ask people to mix a list with items with other data into a array data set instead?
If something is a list and has a limit/offset of any kind, the data is totally fine in the root of the data as there should be no other data results on the same level

# Notifications
Warning: Endpoint#listNotifications: @return: Avoid using lists as top-level data structure to allow extending the response in the future

# Spreed
Warning: Ban#listBans: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Bot#adminListBots: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Bot#listBots: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: BreakoutRoom#configureBreakoutRooms: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: BreakoutRoom#broadcastChatMessage: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: BreakoutRoom#applyAttendeeMap: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: BreakoutRoom#startBreakoutRooms: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: BreakoutRoom#stopBreakoutRooms: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Call#getPeersForCall: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Chat#receiveMessages: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Chat#getMessageContext: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Chat#mentions: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Chat#getObjectsSharedInRoom: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Federation#getShares: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Room#getRooms: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Room#getListedRooms: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Room#getBreakoutRooms: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Room#getParticipants: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Room#getBreakoutRoomParticipants: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Signaling#pullMessages: @return: Avoid using lists as top-level data structure to allow extending the response in the future

# Tables
Warning: api1#index: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: api1#indexViews: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: api1#indexViewShares: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: api1#indexTableShares: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: api1#indexTableColumns: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: api1#indexViewColumns: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: api1#indexTableRowsSimple: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: api1#indexTableRows: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: api1#indexViewRows: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: ApiTables#index: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: ApiColumns#index: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Context#index: @return: Avoid using lists as top-level data structure to allow extending the response in the future

# Server
Warning: AutoComplete#get: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: CollaborationResources#searchCollections: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: CollaborationResources#getCollectionsByResource: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Navigation#getAppsNavigation: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Navigation#getSettingsNavigation: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: ReferenceApi#getProvidersInfo: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: UnifiedSearch#getProviders: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Template#list: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Api#getUserMounts: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: ShareAPI#getShares: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: ShareAPI#getInheritedShares: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: ShareAPI#pendingShares: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: DeletedShareAPI#index: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Remote#getShares: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Remote#getOpenShares: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Groups#getSubAdminsOfGroup: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Users#getEditableFields: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Users#getEditableFieldsForUser: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Users#getUserSubAdminGroups: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: DeclarativeSettings#getForms: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: PredefinedStatus#findAll: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Statuses#findAll: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: WeatherStatus#getFavorites: @return: Avoid using lists as top-level data structure to allow extending the response in the future
Warning: Webhooks#index: @return: Avoid using lists as top-level data structure to allow extending the response in the future

@provokateurin
Copy link
Member Author

Usually it is fine to have a list as the top-level data structure and it makes sense in many cases, but if you ever need to extend it with something that is not part of the list you have to make a completely new and separate endpoint for it.
For example if you have a pagination and want to return the cursor information in addition to the data, but previously you only returned the data.
Since it is only a warning you are still free to ignore it.

@nickvergessen
Copy link
Member

Since it is only a warning you are still free to ignore it.

I kind of disagree. If there are too many warnings people will ignore the warnings and miss out on real warnings.

For example if you have a pagination and want to return the cursor information in addition to the data, but previously you only returned the data.

You could follow industry standard praxis and add a header for "next page"?

@provokateurin
Copy link
Member Author

I still think it is better to avoid top-level lists, but I'm fine with not warning about it. Developers should know what they are doing 🤷‍♀️

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.

Warn about lists as top-level data structure
2 participants