This brings me back to the original point: if I have 2 models, Customer and Order, and they each have a "find" method, I would like the sdk to be
Customer.find() and Order.find() At the moment, because the operationId is Customer_find and Order_find, the actual method names are Customer.CustomerFind() and Order.OrderFind() which looks ugly if I used guid1 and guid2 as the operationids, then the models are Customer.guid1() and Order.guid2() which is also ugly ;) Is there an "alias" or "methodname" property in the spec that would allow me to have a unique operationId, but a method name of "find" (in this particular case) ? Julian On Tuesday, 27 September 2016 15:32:04 UTC+1, tony tam wrote: > > Hi, indeed you can use numbers or a guid. Just keep in mind that tooling > (swagger-ui or codegen) may need to coerce that string to something > appropriate (i.e. you can’t typically have hyphens in a method name for > client SDKs). > > Also… since that field is optional you can choose to not supply it at > all—then the consumer has to invent something on its’ own. > > On Sep 27, 2016, at 1:22 AM, jmls <[email protected] <javascript:>> wrote: > > thanks for the reply, Tony > > can I just clarify something : you said " *you should have unique numbers > for all operationId values*" , so does that mean a guid / uuid would be > acceptable ? If so, how do you *name* the endpoint ? > > This is perhaps where my confusion is coming from. I completely understand > the requirement for operationId to be unique, but is there a name / > nickname / alias property I can use to name the method ? I've only seen an > operationid containing a "meaningful" (ie getPet) value rather than a > number / id / guid etc > > Thanks > > On Tuesday, 27 September 2016 03:08:56 UTC+1, tony tam wrote: >> >> Hi, you should have unique numbers for all operationId values. If the >> tools work, it doesn’t make it right—it just means they’re being lenient. >> They could throw errors but the authors have decided to gracefully handle >> the error in the spec. >> >> On Sep 24, 2016, at 11:05 AM, jmls <[email protected]> wrote: >> >> Hey all >> >> Been looking through the v2 specification ( >> http://swagger.io/specification/) , and came across this statement: >> >> *operationId: Unique string used to identify the operation. The id MUST >> be unique among all operations described in the API. Tools and libraries >> MAY use the operationId to uniquely identify an operation, therefore, it is >> recommended to follow common programming naming conventions.* >> >> I am slightly confused about this : >> >> if I have 2 models (Customer and Order) does this mean that a "*find*" >> method must be unique across both, or just within the model ? (ie is the >> API the model or all models ? ) >> >> So I tried an experiment: I have 2 operationId's of "find" : 1 on the >> customer and one on the order >> >> I then ran swagger codegen and it didn't complain about uniqueness. >> >> I then added *another* "find" to the Customer model, and this time codegen >> *did* complain about non-unique operationid's - and renamed it to find_1 >> >> So - is swagger-codegen wrong, or are operationId's unique within a model >> and not the whole API ? >> >> Thanks >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Swagger" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> >> >> > -- > You received this message because you are subscribed to the Google Groups > "Swagger" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
