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

Feature request: allow specifying Operation IDs #14

Closed
pvgoran opened this issue Dec 24, 2018 · 5 comments
Closed

Feature request: allow specifying Operation IDs #14

pvgoran opened this issue Dec 24, 2018 · 5 comments

Comments

@pvgoran
Copy link
Contributor

pvgoran commented Dec 24, 2018

The auto-generated Operation IDs are often long, ugly and unconvenient to work with. It would be good to be able to specify Operation IDs manually in the tinyspec files.

For example, it could be done like this (using tests/endpoints/sources/complex.endpoints.tinyspec as a base):

    // Update resources                                                                                               
    @token updateResource = PATCH /parent/:a/resources/:b:integer (variant)?c&d?&e:boolean {f, g?, h: i[]}                             
        => 200 {resource: Resource} # Another comment                                                                 
        => 404 NotFoundError  

This would make updateResource the Operation ID. The syntax feels natural and non-intrusive, but of course it could be different.

I suppose I can implement this in the code, as long as I know what syntax to use.

@Ajaxy
Copy link
Owner

Ajaxy commented Dec 26, 2018

I like the idea. How about moving it even before token, so it represents the logic of name = definition pair?

  // Update resources                                                                                               
  updateResource = @token PATCH /parent/:a/resources/:b:integer (variant)?c&d?&e:boolean {f, g?, h: i[]}                             
    => 200 {resource: Resource} # Another comment                                                                 
    => 404 NotFoundError  

@Ajaxy
Copy link
Owner

Ajaxy commented Dec 26, 2018

Another option would be to move it backward representing definition "name" format.

  // Update resources                                                                                               
  @token PATCH /parent/:a/resources/:b:integer (variant)?c&d?&e:boolean {f, g?, h: i[]} "updateResource"                          
    => 200 {resource: Resource} # Another comment                                                                 
    => 404 NotFoundError  

  @token GET /users "getUsers"
    => {users: User[]}

Just an idea, I'm OK with both variants.

@pvgoran
Copy link
Contributor Author

pvgoran commented Dec 26, 2018

How about moving it even before token, so it represents the logic of name = definition pair?

The name before the tags has its merits, I'm ok with this. (I was placing it after the tags by following the stylistics of Java annotations.)

Another option would be to move it backward representing definition "name" format.

I don't like this. The definition can be quite long, and the name at the end will be hard to notice and track.

@Ajaxy
Copy link
Owner

Ajaxy commented Jan 8, 2019

Hey @pvgoran, are you still planning to implement this?

@pvgoran
Copy link
Contributor Author

pvgoran commented Jan 8, 2019

@Ajaxy Yes, just a bit later. Right now, I'm preoccupied with the holiday activities.

pvgoran added a commit to pvgoran/tinyspec that referenced this issue Jan 12, 2019
Operation definitions can now start with `<OperationId> = ` to provide
Operation IDs instead of automatically generated ones.

Closes Ajaxy#14.
pvgoran added a commit to pvgoran/tinyspec that referenced this issue Jan 17, 2019
Operation definitions can now start with `<OperationId> = ` to provide
Operation IDs instead of automatically generated ones.

Closes Ajaxy#14.
@Ajaxy Ajaxy closed this as completed in #15 Jan 18, 2019
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

No branches or pull requests

2 participants