Skip to content

[Proposal] Automatically set type to Integer for entity 'id' fields #56

@Fs00

Description

@Fs00

Hello!
We noticed that the default type that gets added to Swagger docs is string for all fields unless otherwise specified, which is already good in most cases.
However, when we create a new entity we often find ourselves writing the following line (when we don't forget about it):

expose :id, documentation: { type: :integer }

Given that probably 99% of Rails apps out there use integer IDs for their entities, wouldn't it be great if Grape automatically set the type to Integer for id fields? The user would then still be able to override it with the most appropriate type if needed, as now happens with all other 'string-by-default' fields.

I'm not sure if this is the right repo where this feature should be requested (maybe grape-swagger? or grape-entity?), feel free to move this issue into the more appropriate one.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions