Swagger specification for SL.se API found at Trafiklab.
This repository contains documentations with Swagger specifications. It's a standardizised way of defining an API with either JSON or YAML which include operations and models. With this you can for example generate code to produce or consume, ie server or client.
Include documentations for the following APIs:
- SL Hållplatser och Linjer 2
- SL Närliggande hållplatser
- SL Platsuppslag
- SL Realtidsinformation 4
- SL Reseplanerare 2
- SL Störningsinformation 2
- SL Trafikläget 2
With Swagger Code Generator clients and servers can be generated by using this specification, https://stranne.github.io/SL.se-api-specs/swagger.json, for multiple languages.
Some of the supported client generators, for more examples check here.
- android
- csharp
- java
- php
- python
- ruby
- swift3
- typescript-angular2
To generate a client online, go here. On that page, expand and navigate to clients
-> POST /gen/clients/{language}
. Select one of the languages in the dropdown and paste the JSON below into the body textarea.
{
"spec": {},
"options": {},
"swaggerUrl": "https://stranne.github.io/SL.se-api-specs/swagger.json"
}
Click Try it out! and you will get a url in the response. You can download it once to acquire a zip-folder of the generated client.
- Documentation(ReDoc): https://stranne.github.io/SL.se-api-specs/
- SwaggerUI: https://stranne.github.io/SL.se-api-specs/swagger-ui/
- Look full spec:
- Preview spec version for branch
[branch]
: https://stranne.github.io/SL.se-api-specs/preview/[branch]
Warning: All above links are updated only after Travis CI finishes deployment
- Install Node JS
- Clone repo and
cd
- Run
npm install
- Run
- Run
npm start
- Checkout console output to see where local server is started. You can use all links (except
preview
) by replacing https://stranne.github.io/SL.se-api-specs/ with url from the message:Server started <url>
- Make changes using your favorite editor or
swagger-editor
(look for URL in console output) - All changes are immediately propagated to your local server, moreover all documentation pages will be automagically refreshed in a browser after each change
TIP: you can open
swagger-editor
, documentation andswagger-ui
in parallel - Once you finish with the changes you can run tests using:
npm test
- Share you changes with the rest of the world by pushing to GitHub 😄