These are chat archives for APIs-guru/api-models

24th
Aug 2015
Ivan Goncharov
@IvanGoncharov
Aug 24 2015 18:11
@bobby-brennan I have a plan to optimise API
to make it something like this:
[
  "swagger": "https://apis-guru.github.io/api-models/googleapis.com/youtube/v3/swagger.json",
  "created": "2015-07-13",
  "updated": "2015-08-24",
  "info": {
    "contact": {
      "name": "Google",
      "url": "https://google.com"
    },
    "description": "Programmatic access to YouTube features.",
    "title": "YouTube Data API",
    "version": "v3",
    "x-logo": "https://www.youtube.com/yt/brand/media/image/YouTube-logo-full_color.png",
    "x-origin": {
      "format": "google",
      "url": "https://www.googleapis.com/discovery/v1/apis/youtube/v3/rest",
      "version": "v1"
    },
    "x-providerName": "googleapis.com",
    "x-serviceName": "youtube"
  },
  ...
]
what do you think?
So info is fully copied from Swagger
Bobby Brennan
@bobby-brennan
Aug 24 2015 19:03
So this will be apilist.json?
that will help a ton
currently I have to fetch swagger for every API to load the homepage
Ivan Goncharov
@IvanGoncharov
Aug 24 2015 19:04
Yes, I probably choose different name
Bobby Brennan
@bobby-brennan
Aug 24 2015 19:04
even though I just need title/logo/description
perfect
Ivan Goncharov
@IvanGoncharov
Aug 24 2015 19:05
you also wanted dates
I will add them
probably first version will be without them
I'm not sure about different versions of same API
should I group them together somehow
?
Bobby Brennan
@bobby-brennan
Aug 24 2015 20:07
I'd actually prefer if API list returned an array of {provider, name} pairs, and grouped versions together
right now I have code that tries to go through all the versions of an API and pick the best one
Maybe info should be copied from the latest version, and you can have a versions object that points to different swagger files
along with a default or latest version
Ivan Goncharov
@IvanGoncharov
Aug 24 2015 20:54
problem is that I don't have mechanism to mark latest version
and it should be done manually
right now it problem for Google APIs mainly
Bobby Brennan
@bobby-brennan
Aug 24 2015 21:21
```js
  var compareVersions = function(one, two) {
    if (one === two) return 0;
    var oneBeta = one.indexOf('beta') !== -1;
    var twoBeta = two.indexOf('beta') !== -1;
    if (oneBeta !== twoBeta) return oneBeta ? 1 : -1;
    var versionRegex = /v(\d+(\.\d+)?)/
    var oneVersion = one.match(versionRegex) || [];
    var twoVersion = two.match(versionRegex) || [];
    oneVersion = parseFloat(oneVersion[1] || '0');
    twoVersion = parseFloat(twoVersion[1] || '0');
    if (oneVersion !== twoVersion) return oneVersion < twoVersion ? 1 : -1;
    return one < two ? -1 : 1;
  }
that's my code, in case it's helpful
Ivan Goncharov
@IvanGoncharov
Aug 24 2015 21:22
thanks
Bobby Brennan
@bobby-brennan
Aug 24 2015 21:22
I think even a bad first pass at picking out the best version will make the repository a lot more useful
right now every client has to implement their own version of that, and you don't want to have different clients with inconsistent implementations
Ivan Goncharov
@IvanGoncharov
Aug 24 2015 21:23
yes
you right it basically my problem :(
Bobby Brennan
@bobby-brennan
Aug 24 2015 21:24
let me know if I can help :)
Ivan Goncharov
@IvanGoncharov
Aug 24 2015 21:24
I want to make draft version of new API tomorow
put it under /api/v1/ to not break anything
and when my friend agreed to prototype widget
"API picker"
he develop web widgets for last year
so try to do basic version with just pictures and descriptions
he will do this as JS script that will be hosted on Github
Bobby Brennan
@bobby-brennan
Aug 24 2015 22:15
awesome, sounds good
let me know when it's ready and I'll migrate AnyAPI over to the new API
Ivan Goncharov
@IvanGoncharov
Aug 24 2015 22:16
ок
Bobby Brennan
@bobby-brennan
Aug 24 2015 23:49
looks like SDKs.io is scraping GitHub for swagger.json files:
quality seems pretty bad
Ivan Goncharov
@IvanGoncharov
Aug 24 2015 23:49
yes
I known
probably they are best candidate for early adopters
just need to redo API before writing to them
Bobby Brennan
@bobby-brennan
Aug 24 2015 23:50
definitely
actually
they're already using you as a source :)
the "view docs" link goes to api-models
Ivan Goncharov
@IvanGoncharov
Aug 24 2015 23:52
yes
i know
but it hard to find in all Github mess
Bobby Brennan
@bobby-brennan
Aug 24 2015 23:53
yeah it'd be awesome if they had you as a source tag on the left