Skip to content

Commit

Permalink
Better docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bunyk committed Jun 21, 2018
1 parent 9db0000 commit e51fba6
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ Transform your JSON Schema draft-07 to OpenAPI 3.0
[![Build Status](https://travis-ci.org/bunyk/jsonschema2openapi.svg?branch=master)](https://travis-ci.org/bunyk/jsonschema2openapi)
[![GoDoc](https://godoc.org/github.com/bunyk/jsonschema2openapi?status.svg)](https://godoc.org/github.com/bunyk/jsonschema2openapi)

PutSchemaIntoOpenAPI will put `definitions` from provided JSON Schema into your OpenAPI 3.0 specification `component.schemas`. Also it will
* Cleanup any `$schema` or other keys from JSON Reference objects
* Any reference to `#/definitions` will lead to `#/component/schemas`
* `"oneOf": [{"type": X}, {"type": "null"}]` will be replaced with `"type": X, "nullable": true`
* TODO: finish doc

## Installation

```
Expand All @@ -12,15 +18,20 @@ go get github.com/bunyk/jsonschema2openapi
## Usage example

```go

package main

import (
"fmt"
"github.com/bunyk/jsonschema2openapi"
)

func main() {
..

APISpec, err := PutSchemaIntoOpenAPI(schema, openapitemplate)
if err == nil {
fmt.Println(APISpec)
} else {
fmt.Println(err.Error())
}

See more complete example in docs: https://godoc.org/github.com/bunyk/jsonschema2openapi#PutSchemaIntoOpenAPI

```

0 comments on commit e51fba6

Please sign in to comment.