GfSE / SpecIF-OpenAPI

Web API definition for SpecIF
Apache License 2.0
0 stars 0 forks source link

API SHOULD follow best practices #2

Open odungern opened 4 years ago

odungern commented 4 years ago

e.g. Microsoft API Guidelines

oalt commented 4 years ago

Some links to best practices: http://apistylebook.com/design/guidelines/ https://restfulapi.net/resource-naming/ https://www.merixstudio.com/blog/best-practices-rest-api-development/

odungern commented 4 years ago

Also: http://apistylebook.com/design/guidelines/google-api-design-guide

odungern commented 4 years ago

With respect to our discussion REST URL-elements (tags): camelCase or hyphenated ( ../dataTypes/,, vs. ../data-types/..):

BUT: I think it is important to have the same tags/tokens in the schema and the API (see #5).

My proposal:

What do you think: @oalt @oeichmann @S-Ruesch ?

S-Ruesch commented 4 years ago

My proposal:

  • use all lowercase tags starting SpecIF v1.0, both in the schema and the API.
  • means we will say datatypes, propertyclasses, resourceclasses and statementclasses - in the schema there are no other in camelCase, so far.
  • I think those are not too difficult to read, so that using a dash is not really a 'must'.

In the schema there are more camelCase tags, for example changedAt, changedBy or specifVersion. Or am i wrong? I think i would prefer camelCase or hyphenated for better readability. But i don't have a favorite naming convention.

odungern commented 4 years ago

More important is in my opinion the consistency between schema and API as well as the consistency with standards in various technologies, from JS, JSON, XML and all of the W3C web standards. Then, we arrive at the least common denominator, the lowercase version.

oalt commented 4 years ago

I do not like the idea to give up camel case in the SpecIF schema. I think this is not good for the readability of the JSON data. And I repeat my argumentation I said in the Telco: Different languages resp. technologies have different coding standards. JSON uses camel case in the most cases and Web APIs use the notation with lower case and '-' symbol separation very often. At the end all the names mean the same thing! So for me it would be not the most important thing to have equal formatting for the JSON and the WebAPI. One example for the "diversity approach" is the OpenAPI code generator: From the same OpenAPI spec file it generates code for different languages in different formatting. Example: GET /data-types will result in