ruby-grape / ruby-grape/grape-swagger

Deeply nested objects

Open
#751 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
1.1k
Forks
479
Avg merge
2d 14h
Merged PRs (30d)
6

Description

The model we use for our API is strongly nested, we are working in Vehicle Routing Optimization and define a complex model in a single request. There are multiple high level objects such as
Services (missions to perform within a route) and Points (coordinates or matrix reference)

Within those objects are others objects
an Activity for Services which have a mission to perform or Activities, if we have alternatives available to perform a delivery.

Points have a single object below, which is the location (lat/lon)

The model is correctly validated with grape and works like a charm at this purpose.
But the generation of the documentation through grape-swagger generate some incorrect types

Location should be an hash, but is displayed as an array of hash.
Skills related to Services are displayed as String and should be array of string
Activity is displayed as an array of hash, and should be a single hash.
Activities are correctly displayed as an array of hash.

Please see the related pull request which display the errors.
Has anyone any hints on how I could to solve it or by my side, or by contributing if the bug is confirmed ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests. Begin by reproducing the nested Vehicle Routing Optimization schema and comparing Grape validation with the documentation generated by grape-swagger. Done means the generated types match the stated model: Location and Activity are objects, while Skills and Activities use the intended array types.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.