Comments (4)
swagger-json uses the term 'nickname' as a hint for the name to use for the generated methods. I kind of dislike that approach because it puts extra logic into api.json that really doesn't add any value to documenting the API - i.e. it's just a feature for code generation.
Since the paths are unique - I feel like we can add a small rule to generate better names...
/organizations/:organization/:name/teams ==> getTeamsByName
/organizations/:organization/:name/members ==> getMembersByName
/organizations/:organization/:name/members/:email ==> getMembersByNameAndEmail
so essentially all path parameters joined by "And" come after "By". Non parameter path parts can just be joined
from apibuilder.
/organizations/:guid ==> getOrganizationsByGuid
I don't think the code can always make the right guess for the name. The code could detect when there is a conflict and only apply the rule to the conflicting methods, but that seems like it is starting to get too clever. Even then, it would not be able to make a good choice in the case of
/poems/:guid
/rhymes/:guid
from apibuilder.
Let's chat - I'm missing some context as the example you gave in my mind
has 0 chance of collision (they are different resources, and thus will have
different namespaces to begin with)
On Tue, Jun 3, 2014 at 4:54 AM, Michael Reed [email protected]
wrote:
/organizations/:guid ==> getOrganizationsByGuid
I don't think the code can always make the right guess for the name. The
code could detect when there is a conflict and only apply the rule to the
conflicting methods, but that seems like it is starting to get too clever.
Even then, it would not be able to make a good choice in the case of/poems/:guid
/rhymes/:guid
—
Reply to this email directly or view it on GitHub
#9 (comment).
from apibuilder.
I think you've won me over. We just need a way of excluding the toplevel resource path from the rule so you don't end up with getOrganizationsByGuid instead of getByGuid.
The second example I had is assuming that the toplevel resource had a path of the empty string, and those are paths on operations. But actually those would just be poorly named operations if they were meant to refer to single items.
from apibuilder.
Related Issues (20)
- Swagger enums are not imported when defined in an array
- Swagger import fails on circular model dependencies
- Create a tutorial for apibuilder setup (+ Update the docker files to workable apibuilder) HOT 3
- Instructions for running service on private kubernetes cluster
- Union Types: Models can belong to different union types with different discriminators HOT 1
- Imported services duplicates in invocation form
- Add schema to https://www.schemastore.org/json/ HOT 5
- API pages: Hyperlinks from models do not work with interface types
- Problem in the example file(api.json)
- Python support
- Swagger: Path definition ignored silently if no 200 response defined
- Add http4s 0.22.x support HOT 1
- Auto authorize membership in API Builder based on GitHub org
- Support OpenAPI3 HOT 4
- Swagger: path definition ignored when unit returned in 2xx response HOT 1
- Add http4s 0.23.x Generator HOT 1
- Union types don't automatically inherit Interface fields during code generation HOT 1
- Unions generation: The operator '[]' isn't defined for the class 'int' HOT 4
- Union type json readers should check discriminator HOT 1
- Will you support $refs like the OpenAPI specification? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apibuilder.