Skip to content

RouteSpec Attributes #617

@noboomu

Description

@noboomu

Was wondering if it makes sense to add the route attributes to the RouteSpec? I was able to work around an issue I had with generating our Swagger docs by doing this. I understand the desire to keep the spec clean and parse only the comments and existing annotations, however, I feel that greater customization should be at least an option. By adding something like

   route.attributes().ifPresent( a -> {
        	
        	a.entrySet().stream().forEach( e -> {
        		
        		if(e.getKey().equals("nickname"))
        		{
            		         op.setOperationId(e.getValue().toString()); 
        		}
        		else if(e.getKey().equals("apiOperation"))
        		{
            		         op.summary(e.getValue().toString()); 
        		}
        		else if(e.getKey().equals("notes"))
        		{
            		         op.setDescription(e.getValue().toString()); 
        		} 
        		
        	}); 
        });

to the Swagger builder and the following annotation to an mvc path

@ApiOperation(value="Find users by email address",nickname="findUsersByEmail")

I was able to get what I wanted. Is there any downside to adding the attributes to the RouteSpec? That way users can build their own routing modules for Swagger/RAML without having to alter the core code base.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions