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 months 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 (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-04-30T22:51:22.000Z (about 1 year ago)
- Last Synced: 2025-04-30T23:19:05.949Z (about 1 year ago)
- Topics: golang, golang-library, raml
- Language: Go
- Homepage:
- Size: 496 KB
- Stars: 2
- Watchers: 1
- 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:
----