Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/foxcapades/lib-go-raml
Type definitions & utilities for working with RAML in Go
https://github.com/foxcapades/lib-go-raml
golang golang-library raml
Last synced: 5 days ago
JSON representation
Type definitions & utilities for working with RAML in Go
- Host: GitHub
- URL: https://github.com/foxcapades/lib-go-raml
- Owner: Foxcapades
- License: mit
- Created: 2020-05-15T01:42:38.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-17T16:44:59.000Z (almost 2 years ago)
- Last Synced: 2024-10-17T01:18:42.837Z (20 days ago)
- Topics: golang, golang-library, raml
- Language: Go
- Homepage:
- Size: 438 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.adoc
- License: license
Awesome Lists containing this project
README
= RAML <--> Go
Parser & serializer for https://raml.org/[RAML] documents to/from concrete Go
types..cmd/example/main.go
[source, go]
----
func main() {
res, err := simple.GetRequest("https://raw.githubusercontent.com/raml-org/raml-examples/master/annotations/advanced.raml").
Submit().
GetRawResponse()
check(err)
defer res.Body.Close()api, err := rparse.ParseApiDoc(res.Body)
check(err)check(api.WriteRAML(os.Stdout))
}func check(err error) {
if err != nil {
panic(err)
}
}
----.example output
[source, sh-session]
----
$ go run v0/cmd/example/main.go
#%RAML 1.0
---
title: Illustrating annotations
mediaType:
- application/json
annotationTypes:
deprecated: nil
experimental: string | nil
feedbackRequested: string?
testHarness:
type: string # This line may be omitted as it's the default type
badge:
clearanceLevel:
properties:
level:
enum: [low, medium, high]
required: true
signature:
pattern: "\\d{3}-\\w{12}"
required: true
/groups:
(experimental):
(feedbackRequested):
/users:
(testHarness): usersTest
(badge): tested.gif
(clearanceLevel):
level: high
signature: 230-ghtwvfrs1itr
get:
(deprecated):
(experimental):
(feedbackRequested): Feedback committed!
responses:
200:
----