erunion / mill

☴ An annotation-based DSL for documenting a REST API.
MIT License
39 stars 2 forks source link

Versioning doesn't allow for differing documentation #75

Open erunion opened 7 years ago

erunion commented 7 years ago
/**
 * @api-data pictures (\App\PictureRepresentation) - The active picture for this video.
 */

/**
 * @api-data pictures (array<object>) - The video's thumbnail images
 * @api-version <3.2
 */

Problem stems from us storing representation data in an identifier-keyed array when parsing it out in the RepresentationParser.

erunion commented 7 years ago

Another common example of this is enum values differing between API versions:

* @api-param:public {filter}
*      + Members
*          - `embeddable`
*          - `playable`
*          - `app_only`
*
* @api-version >=3.3.8
* @api-param:public {filter}
*      + Members
*          - `featured`
erunion commented 5 years ago

Trying to do the above example with enum reductions isn't going to work. Maybe the best bet is just to force the developer to copy documentation from one version to another?

* @api-data status (enum, required, nullable) - The status code for the availability of the video. This field is deprecated in favor of `upload` and
*      `transcode`.
*      + Members
*          - `available` - The video is available.
*          - `unavailable` - The video is unavailable.
*          - `uploading` - The video is being uploaded.
*          - `transcode_starting` - Transcoding is beginning for the video.
*          - `transcoding` - Transcoding is underway for the video.
*          - `quota_exceeded` - The user's quota is exceeded with this video.
*          - `uploading_error` - There was an error in uploading the video.
*          - `transcoding_error` - There was an error in transcoding the video.
* 
* @api-version >=3.4.1
* @api-data status (enum, required, nullable) - The status code for the availability of the video. This field is deprecated in favor of `upload` and
*      `transcode`.
*      + Members
*          - `available` - The video is available.
*          - `unavailable` - The video is unavailable.
*          - `uploading` - The video is being uploaded.
*          - `transcode_starting` - Transcoding is beginning for the video.
*          - `transcoding` - Transcoding is underway for the video.
*          - `quota_exceeded` - The user's quota is exceeded with this video.
*          - `total_cap_exceeded` - The user has exceeded their total cap with this video.
*          - `uploading_error` - There was an error in uploading the video.
*          - `transcoding_error` - There was an error in transcoding the video.

That feels like a huge burden though.