Skip to content

API requires "_until: ISO8601" argument everywhere as opposed to "until: ISO8601" datetime #13

Open

Description

@bretweinraub

A note for the documentation or maybe even a fix.

Being that until is a reserved word in Ruby, you one cannot make an api call like

api.get_course_list(since: ..., until: ...)

it must be

api.get_course_list(since: ..., _until: ...)

I guess that Swagger does this.

If one looks at the code though it is unnecessary and is just a artifact of the code generator.

Activity

  1. mjschuetze102 commented on Nov 9, 2022

    @mjschuetze102
    Contributor

    If one looks at the code though it is unnecessary and is just a artifact of the code generator.

    Because until is used as a hash key the keyword problem no longer exists?

    I guess that Swagger does this.

    Yea, Swagger did do this. I don't think it would be hard to change, but don't know what other underlying problems doing so would cause. I can go ahead and look into it, but it probably wouldn't be changed any time soon

  2. bretweinraub commented on Nov 9, 2022

    @bretweinraub
    Author

    If one looks at the code though it is unnecessary and is just a artifact of the code generator.

    Because until is used as a hash key the keyword problem no longer exists?

    I that is correct. I've not tried it though.

    There are lines like this:

          query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    

    but nothing else really.

  3. bretweinraub commented on Nov 9, 2022

    @bretweinraub
    Author

    I checked this is the only param that has the issue:

    -> ag --literal --group --line-number --column --color --color-match 30\;43 --color-path 1\;32 --smart-case --stats -- \:\'_ .
    File: api/xapi_api.rb
    429:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    
    File: api/course_api.rb
    1043:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    1425:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    1490:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    1616:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    
    File: api/registration_api.rb
    938:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    1006:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    1193:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    1326:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    
    File: api/invitations_api.rb
    231:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    471:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    549:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    681:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    759:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    
    File: api/dispatch_api.rb
    496:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    804:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    987:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    1392:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    2380:37:      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
    
  4. d-hansen commented on Nov 10, 2022

    @d-hansen

    I would recommend it get fixed to support both forms.
    Please don't break backwards compatibility for people already using :_until!

    Eg, perhaps if the generated code looked something more like this (perhaps this needs to be a swagger patch?):

          query_params[:'until'] = opts[:'until'] if !opts[:'until'].nil?
          query_params[:'until'] = opts[:'_until'] if query_params[:'until'].nil? && !opts[:'_until'].nil?
    
  5. bretweinraub commented on Nov 11, 2022

    @bretweinraub
    Author

    Good idea. I'd say anything using :_until should throw a deprecation warning for a while ..... then it should be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions