소스 검색

Merge pull request #426 from davemachado/master

Add new format validation check and update logic
pull/431/head
Dave Machado 6 년 전
committed by GitHub
부모
커밋
0e00123f51
2개의 변경된 파일99개의 추가작업 그리고 58개의 파일을 삭제
  1. +21
    -21
      README.md
  2. +78
    -37
      build/validate_format.rb

+ 21
- 21
README.md 파일 보기

@@ -82,7 +82,7 @@ API | Description | Auth | HTTPS | Link |
| Harvard Art Museums | Art | `apiKey` | No | [Go!](https://github.com/harvardartmuseums/api-docs) |
| Icons8 | Icons | `OAuth` | Yes | [Go!](http://docs.icons8.apiary.io/#reference/0/meta) |
| Noun Project | Icons | `OAuth` | No | [Go!](http://api.thenounproject.com/index.html) |
| Rijksmuseum| Art | `apiKey` | Yes | [Go!](https://www.rijksmuseum.nl/en/api) |
| Rijksmuseum | Art | `apiKey` | Yes | [Go!](https://www.rijksmuseum.nl/en/api) |

### Books
API | Description | Auth | HTTPS | Link |
@@ -173,9 +173,9 @@ API | Description | Auth | HTTPS | Link |
| Gitter | Chat for GitHub | `OAuth` | Yes | [Go!](https://github.com/gitterHQ/docs) |
| HackerRank | Compile source code and run against a set of provided test cases | `apiKey` | Yes | [Go!](https://www.hackerrank.com/api/docs) |
| Hipster Ipsum | Generates Hipster Ipsum text | No | No | [Go!](http://hipsterjesus.com/) |
| IPify | A simple IP Address API | No | Yes | [Go!](https://www.ipify.org/) |
| IPify | A simple IP Address API | No | Yes | [Go!](https://www.ipify.org/) |
| JSON 2 JSONP | Convert JSON to JSONP (on-the-fly) for easy cross-domain data requests using client-side JavaScript | No | Yes | [Go!](https://json2jsonp.com/) |
| JSONbin.io | Free JSON storage service. Ideal for small scale Web apps, Websites and Mobile apps. | No | Yes | [Go!](https://jsonbin.io) |
| JSONbin.io | Free JSON storage service. Ideal for small scale Web apps, Websites and Mobile apps | No | Yes | [Go!](https://jsonbin.io) |
| JSONPlaceholder | Fake data for testing and prototyping | No | No | [Go!](http://jsonplaceholder.typicode.com/) |
| Judge0 API | Compile and run source code | No | Yes | [Go!](https://api.judge0.com/) |
| Kairos | Face Recognition and Emotion Analysis | `apiKey` | Yes | [Go!](https://www.kairos.com/features) |
@@ -201,7 +201,7 @@ API | Description | Auth | HTTPS |Link |
| File.io | File Sharing | No | Yes | [Go!](https://www.file.io) |
| pdflayer API | HTML/URL to PDF | No | Yes | [Go!](https://pdflayer.com) |
| Pocket | Bookmarking service | `OAuth` | Yes | [Go!](https://getpocket.com/developer/) |
| PrexView | Data from XML or JSON to PDF, HTML or Image | `apiKey` | Yes | [Go!](https://prexview.com) |
| PrexView | Data from XML or JSON to PDF, HTML or Image | `apiKey` | Yes | [Go!](https://prexview.com) |
| Todoist | Todo Lists | `OAuth` | Yes | [Go!](https://developer.todoist.com) |
| Wunderlist | Todo Lists | `OAuth` | Yes | [Go!](https://developer.wunderlist.com/documentation) |

@@ -243,8 +243,8 @@ API | Description | Auth | HTTPS | Link |
| Whitepages Pro | Global identity verification with phone, address, email, and IP | `apiKey` | Yes | [Go!](https://pro.whitepages.com/developer/documentation/identity-check-api/) |
| Whitepages Pro | Phone reputation to detect spammy phones | `apiKey` | Yes | [Go!](https://pro.whitepages.com/developer/documentation/phone-reputation-api/) |
| Whitepages Pro | Get an owner’s name, address, demographics based on the phone number | `apiKey` | Yes | [Go!](https://pro.whitepages.com/developer/documentation/reverse-phone-api/) |
| Whitepages Pro| Phone number validation, line_type, carrier append | `apiKey` | Yes | [Go!](https://pro.whitepages.com/developer/documentation/phone-intelligence-api/) |
| Whitepages Pro| Get normalized physical address, residents, address type, and validity. | `apiKey` | Yes | [Go!](https://pro.whitepages.com/developer/documentation/reverse-address-api/) |
| Whitepages Pro | Phone number validation, line_type, carrier append | `apiKey` | Yes | [Go!](https://pro.whitepages.com/developer/documentation/phone-intelligence-api/) |
| Whitepages Pro | Get normalized physical address, residents, address type, and validity | `apiKey` | Yes | [Go!](https://pro.whitepages.com/developer/documentation/reverse-address-api/) |

### Games & Comics
API | Description | Auth | HTTPS | Link |
@@ -274,20 +274,20 @@ API | Description | Auth | HTTPS | Link |
### Geocoding
API | Description | Auth | HTTPS | Link |
|---|---|---|---|---|
| adresse.data.gouv.fr | Address database of France. geocoding and reverse. | No | Yes | [Go!](https://adresse.data.gouv.fr) |
| adresse.data.gouv.fr | Address database of France, geocoding, and reverse | No | Yes | [Go!](https://adresse.data.gouv.fr) |
| Bing Maps | Create/customize digital maps based on Bing Maps data | `apiKey` | Yes | [Go!](https://www.microsoft.com/maps/) |
| Geocode.xyz | Provides worldwide forward/reverse geocoding, batch geocoding and geoparsing | No | Yes | [Go!](https://geocode.xyz/) |
| GeoNames | Place names and other geographical data | No | No | [Go!](http://www.geonames.org/export/web-services.html) |
| GéoApi | French geographical data | No | Yes | [Go!](https://api.gouv.fr/api/geoapi.html) |
| Google Maps | Create/customize digital maps based on Google Maps data | `apiKey` | Yes | [Go!](https://developers.google.com/maps/) |
| IP 2 Country | Map an IP to a country | No | Yes | [Go!](https://ip2country.info) |
| IP Address Details| Find geolocation with ip address | No | Yes | [Go!](https://ipinfo.io/) |
| IP Location| Find IP address location information | No | Yes | [Go!](https://ipapi.co/) |
| IP Address Details | Find geolocation with ip address | No | Yes | [Go!](https://ipinfo.io/) |
| IP Location | Find IP address location information | No | Yes | [Go!](https://ipapi.co/) |
| IP Vigilante | Free IP Geolocation API | No | Yes | [Go!](https://www.ipvigilante.com/) |
| Mapbox | Create/customize beautiful digital maps | `apiKey` | Yes | [Go!](https://www.mapbox.com/developers/) |
| Mapzen Search | Open Source & Open Data Global Geocoding Service | `apiKey` | Yes | [Go!](https://mapzen.com/products/search/) |
| Mexico | Mexico RESTful zip codes API | No | Yes | [Go!](https://github.com/IcaliaLabs/sepomex) |
| One Map 2.0, Singapore| Singapore Land Authority REST API services for Singapore addresses | `apiKey` | Yes | [Go!](https://docs.onemap.sg/) |
| One Map 2.0, Singapore | Singapore Land Authority REST API services for Singapore addresses | `apiKey` | Yes | [Go!](https://docs.onemap.sg/) |
| OnWater | Determine if a lat/lon is on water or land | No | Yes | [Go!](https://onwater.io/) |
| OpenCage | Forward and reverse geocoding using open data | No | Yes | [Go!](https://geocoder.opencagedata.com) |
| OpenStreetMap | Navigation, geolocation and geographical data | `OAuth` | No | [Go!](http://wiki.openstreetmap.org/wiki/API) |
@@ -356,7 +356,7 @@ API | Description | Auth | HTTPS | Link |
### Open Source projects
API | Description | Auth | HTTPS | Link |
|---|---|---|---|---|
| Countly | Countly web analytics | No | No | [Go!](http://resources.count.ly/docs) |
| Countly | Countly web analytics | No | No | [Go!](http://resources.count.ly/docs) |
| Drupal.org | Drupal.org | No | Yes | [Go!](https://www.drupal.org/drupalorg/docs/api) |
| Libraries.io | Open source software libraries | `apiKey` | Yes | [Go!](https://libraries.io/api) |

@@ -366,7 +366,7 @@ API | Description | Auth | HTTPS | Link |
| chucknorris.io | JSON API for hand curated Chuck Norris jokes | No | Yes | [Go!](https://api.chucknorris.io) |
| Forismatic | Inspirational Quotes | No | No | [Go!](http://forismatic.com/en/api/) |
| icanhazdadjoke | The largest selection of dad jokes on the internet | No | Yes | [Go!](https://icanhazdadjoke.com/api) |
| Medium | Community of readers and writers offering unique perspectives on ideas. | `OAuth` | Yes | [Go!](https://github.com/Medium/medium-api-docs) |
| Medium | Community of readers and writers offering unique perspectives on ideas | `OAuth` | Yes | [Go!](https://github.com/Medium/medium-api-docs) |
| Quotes on Design | Inspirational Quotes | No | Yes | [Go!](https://quotesondesign.com/api-v4-0/) |
| Traitify | Assess, collect, and analyze Personality | No | Yes | [Go!](https://app.traitify.com/developer) |
| tronalddump.io | Api & web archive for the things Donald Trump has said | No | Yes | [Go!](https://www.tronalddump.io) |
@@ -374,7 +374,7 @@ API | Description | Auth | HTTPS | Link |
### Photography
API | Description | Auth | HTTPS | Link |
|---|---|---|---|---|
| 500px | Photography Community | `OAuth` | Yes | [Go!](https://github.com/500px/api-documentation) |
| 500px | Photography Community | `OAuth` | Yes | [Go!](https://github.com/500px/api-documentation) |
| Flickr | Flickr Services | `OAuth` | Yes | [Go!](https://www.flickr.com/services/api/) |
| Gfycat | Jiffier GIFs | `OAuth` | Yes | [Go!](https://developers.gfycat.com/api/) |
| Giphy | Get all your gifs | No | Yes | [Go!](https://github.com/Giphy/GiphyAPI) |
@@ -393,7 +393,7 @@ API | Description | Auth | HTTPS | Link |
| Minor Planet Center | Asterank.com Information | No | No | [Go!](http://www.asterank.com/mpc) |
| NASA | NASA data, including imagery | No | Yes | [Go!](https://api.nasa.gov) |
| Open Notify | ISS astronauts, current location, etc | No | No | [Go!](http://open-notify.org/Open-Notify-API/) |
| Sunrise and Sunset | Sunset and sunrise times for a given latitude and longitude. | No | Yes | [Go!](https://sunrise-sunset.org/api) |
| Sunrise and Sunset | Sunset and sunrise times for a given latitude and longitude | No | Yes | [Go!](https://sunrise-sunset.org/api) |
| USGS Earthquake Hazards Program | Earthquakes data real-time | No | Yes | [Go!](https://earthquake.usgs.gov/fdsnws/event/1/) |
| USGS Water Services | Water quality and level info for rivers and lakes | No | Yes | [Go!](https://waterservices.usgs.gov/) |
| World Bank | World Data | No | No | [Go!](https://datahelpdesk.worldbank.org/knowledgebase/topics/125589) |
@@ -436,7 +436,7 @@ API | Description | Auth | HTTPS | Link |
### Sports & Fitness
API | Description | Auth | HTTPS | Link |
|---|---|---|---|---|
| Cartola FC | The Cartola FC API serves to check the partial points of your team. | No | Yes | [Go!](https://github.com/wgenial/cartrolandofc) |
| Cartola FC | The Cartola FC API serves to check the partial points of your team | No | Yes | [Go!](https://github.com/wgenial/cartrolandofc) |
| City Bikes | City Bikes around the world | No | No | [Go!](http://api.citybik.es/v2/) |
| Ergast F1 | F1 data from the beginning of the world championships in 1950 | No | No | [Go!](http://ergast.com/mrd/) |
| Fitbit | Fitbit Information | `OAuth` | Yes | [Go!](https://dev.fitbit.com/) |
@@ -453,7 +453,7 @@ API | Description | Auth | HTTPS | Link |
API | Description | Auth | HTTPS | Link |
|---|---|---|---|---|
| Postmon | An API to query Brazilian ZIP codes and orders easily, quickly and free | No | No | [Go!](http://postmon.com.br) |
| Sweden | Provides information about parcels in transport | `apiKey` | No | [Go!](https://developer.postnord.com/docs2) |
| Sweden | Provides information about parcels in transport | `apiKey` | No | [Go!](https://developer.postnord.com/docs2) |

### Transportation
API | Description | Auth | HTTPS | Link |
@@ -462,14 +462,14 @@ API | Description | Auth | HTTPS | Link |
| Amadeus Travel Innovation Sandbox | Travel Search - Limited usage | `apiKey` | Yes | [Go!](https://sandbox.amadeus.com/) |
| Bay Area Rapid Transit | Stations and predicted arrivals for BART | `apiKey` | No | [Go!](http://api.bart.gov) |
| Community Transit | Transitland API | No | Yes | [Go!](https://github.com/transitland/transitland-datastore/blob/master/README.md#api-endpoints) |
| Goibibo | API for travel search | `apiKey` | Yes | [Go!](https://developer.goibibo.com/docs) |
| Goibibo | API for travel search | `apiKey` | Yes | [Go!](https://developer.goibibo.com/docs) |
| Indian Railways | Indian Railways Information | `apiKey` | No | [Go!](http://api.erail.in/) |
| Navitia | The open API for building cool stuff with transport data | `apiKey` | Yes | [Go!](https://api.navitia.io/) |
| The Nomad List | A list of the best places to live/work remotely | No | Yes | [Go!](https://nomadlist.com/faq) |
| Schiphol Airport | Schiphol | `apiKey` | Yes | [Go!](https://developer.schiphol.nl/) |
| TransitLand | Transit Aggregation | No | Yes | [Go!](https://transit.land/documentation/datastore/api-endpoints.html) |
| Transport for Atlanta, US | Marta | No | No | [Go!](http://www.itsmarta.com/app-developer-resources.aspx) |
| Transport for Auckland, New Zealand | Auckland Transport API | No | Yes | [Go!](https://api.at.govt.nz/) |
| Transport for Auckland, New Zealand | Auckland Transport | No | Yes | [Go!](https://api.at.govt.nz/) |
| Transport for Belgium | Belgian transport API | No | Yes | [Go!](https://hello.irail.be/api/) |
| Transport for Berlin, Germany | Third-party VBB API | No | Yes | [Go!](https://github.com/derhuerst/vbb-rest/blob/master/docs/index.md) |
| Transport for Boston, US | MBTA API | No | No | [Go!](http://realtime.mbta.com/Portal/Home/Documents) |
@@ -503,12 +503,12 @@ API | Description | Auth | HTTPS | Link |
| Transport for Victoria, AU | PTV API | `apiKey` | Yes | [Go!](https://www.ptv.vic.gov.au/about-ptv/ptv-data-and-reports/digital-products/ptv-timetable-api/) |
| Transport for Washington, US | Washington Metro transport API | `OAuth` | Yes | [Go!](https://developer.wmata.com/) |
| Uber | Request Uber rides, reach riders, transport things, and reward drivers | `OAuth` | Yes | [Go!](https://developer.uber.com/) |
| WhereIsMyTransport | Platform for public transport data in emerging cities | `OAuth` | Yes | [Go!](https://developer.whereismytransport.com/) |
| WhereIsMyTransport | Platform for public transport data in emerging cities | `OAuth` | Yes | [Go!](https://developer.whereismytransport.com/) |

### University
API | Description | Auth | HTTPS | Link |
|---|---|---|---|---|
| Universities List | University names, countries and domains| No | Yes | [Go!](https://github.com/Hipo/university-domains-list) |
| Universities List | University names, countries and domains | No | Yes | [Go!](https://github.com/Hipo/university-domains-list) |

### Vehicle
API | Description | Auth | HTTPS | Link |
@@ -528,7 +528,7 @@ API | Description | Auth | HTTPS | Link |
| TMDb | Community-based movie data | `apiKey` | Yes | [Go!](https://www.themoviedb.org/documentation/api) |
| TVMaze | TV Show Data | No | No | [Go!](http://www.tvmaze.com/api) |
| Vimeo | Vimeo Developer API | `OAuth` | Yes | [Go!](https://developer.vimeo.com/) |
| YouTube | Add YouTube functionality to your sites and apps. | `OAuth` | Yes | [Go!](https://developers.google.com/youtube/) |
| YouTube | Add YouTube functionality to your sites and apps | `OAuth` | Yes | [Go!](https://developers.google.com/youtube/) |

### Weather
API | Description | Auth | HTTPS | Link |


+ 78
- 37
build/validate_format.rb 파일 보기

@@ -1,45 +1,86 @@
#!/usr/bin/env ruby

auth_keys = ['apiKey', 'OAuth', 'X-Mashape-Key', 'No']
punctuation = ['.', '?', '!']
https_keys = ['Yes', 'No']
args = ARGV
filename = args[0]
fail_flag = false
File.foreach(filename).with_index do |line, line_num|

INDEX_TITLE = 1
INDEX_DESCRIPTION = 2
INDEX_AUTH = 3
INDEX_HTTPS = 4
INDEX_LINK = 5
filename = ARGV[0]
$errors = []

def add_error(line_num, val_index, message)
case val_index
when INDEX_TITLE
segment = "Title"
when INDEX_DESCRIPTION
segment = "Description"
when INDEX_AUTH
segment = "Auth"
when INDEX_HTTPS
segment = "HTTPS"
when INDEX_LINK
segment = "Link"
end

$errors.push("(L%03d) %-14.14s #{message}" % [line_num, segment])
end

File.foreach(filename).with_index do | line, line_num |
line_num += 1
if line.start_with?('|')
# Skip table schema lines
if line.eql? "|---|---|---|---|---|\n"
next
end
values = line.split("|")
# Check Description to make sure first character is capitalized
desc_val = values[2].lstrip.chop
if !/[[:upper:]]/.match(desc_val[0])
puts "(#{line_num}) Invalid Description (first char not uppercase): #{desc_val}"
fail_flag = true
end
# Check Auth values to conform to valid options only
auth_val = values[3].lstrip.chop.tr('``', '')
if !auth_keys.include?(auth_val)
puts "(#{line_num}) Invalid Auth (not a valid option): #{auth_val}"
fail_flag = true
end
# Check HTTPS Support values to be either "Yes" or "No"
https_val = values[4].lstrip.chop
if !https_keys.include?(https_val)
puts "(#{line_num}) Invalid HTTPS: (must use \"Yes\" or \"No\"): #{https_val}"
fail_flag = true
end
# Check Link to ensure url is wrapped in "[Go!]" view
link_val = values[5].lstrip.chop
if !link_val.start_with?("[Go!](") || !link_val.end_with?(')')
puts "(#{line_num}) Invalid Link: (format should be \"[Go!](<LINK>)\"): #{link_val}"
fail_flag = true
# Skip non-markdown table lines and table schema lines
if !line.start_with?('|') || line.eql?("|---|---|---|---|---|\n")
next
end

values = line.split("|")

################### GLOBAL ###################
values.each.with_index do |val, val_index|
msg = ""
case val_index
when INDEX_TITLE..INDEX_LINK
# every line segment should start and end with exactly 1 space
if val[/\A */].size != 1 || val[/ *\z/].size != 1
add_error(line_num, val_index, "string should start and end with exactly 1 space")
end
end
end
################# DESCRIPTION ################
# First character should be capitalized
desc_val = values[INDEX_DESCRIPTION].lstrip.chop
if !/[[:upper:]]/.match(desc_val[0])
add_error(line_num, INDEX_DESCRIPTION, "first char not uppercase")
end
# value should not be punctuated
last_char = desc_val[desc_val.length-1]
if punctuation.include?(last_char)
add_error(line_num, INDEX_DESCRIPTION, "description should not end with \"#{last_char}\"")
end
#################### AUTH ####################
# Values should conform to valid options only
auth_val = values[INDEX_AUTH].lstrip.chop.tr('``', '')
if !auth_keys.include?(auth_val)
add_error(line_num, INDEX_AUTH, "not a valid option: #{auth_val}")
end
#################### HTTPS ###################
# Values should be either "Yes" or "No"
https_val = values[INDEX_HTTPS].lstrip.chop
if !https_keys.include?(https_val)
add_error(line_num, INDEX_HTTPS, "must use \"Yes\" or \"No\": #{https_val}")
end
#################### LINK ####################
# Url should be wrapped in "[Go!]" view
link_val = values[INDEX_LINK].lstrip.chop
if !link_val.start_with?("[Go!](") || !link_val.end_with?(')')
add_error(line_num, INDEX_LINK, "format should be \"[Go!](<LINK>)\": #{link_val}")
end
end
if fail_flag
exit(1)
else
exit(0)
$errors.each do | e |
puts e
end
exit($errors.length)

불러오는 중...
취소
저장