Skip to content

Commit db27d87

Browse files
committed
Improved documentation.
1 parent fb47414 commit db27d87

File tree

2 files changed

+29
-64
lines changed

2 files changed

+29
-64
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017-2018 the authors.
3+
Copyright (c) 2017-2018 the project authors.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 28 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,41 @@
11
[![Build Status](https://travis-ci.com/getkin/kin-openapi.svg?branch=master)](https://travis-ci.com/getkin/kin-openapi)
22
[![Go Report Card](https://goreportcard.com/badge/github.com/getkin/kin-openapi)](https://goreportcard.com/report/github.com/getkin/kin-openapi)
33
[![GoDoc](https://godoc.org/github.com/getkin/kin-openapi?status.svg)](https://godoc.org/github.com/getkin/kin-openapi)
4+
[![Join Gitter Chat Channel -](https://badges.gitter.im/getkin/kin.svg)](https://gitter.im/getkin/kin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
45

5-
# Overview
6-
This library provides packages for dealing with OpenAPI specifications.
6+
# Introduction
7+
A [Go](https://golang.org) project for handling [OpenAPI](https://www.openapis.org/) files. We target the latest OpenAPI version (currently 3), but the project contains support for older OpenAPI versions too.
78

8-
## Status
9-
### Current
10-
* [X] Reads and writes [OpenAPI version 3.0 documents](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/README.md)
11-
* [X] Reads and writes [OpenAPI version 2.0 documents](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md) and converts 2.0 -> 3.0 and 3.0->2.0.
12-
* Does NOT support all features.
13-
* [X] Validates:
14-
* [X] That a Go value matches [OpenAPI 3.0 schema object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md#schemaObject)
15-
* [X] That HTTP request matches [OpenAPI operation object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md#operationObject)
16-
* [X] That HTTP response matches OpenAPI 3.0 operation object
17-
* [X] Generates JSON schemas for Go types.
9+
Licensed under the [MIT License](LICENSE).
1810

19-
### TODO
20-
* [ ] More tests
11+
## Contributors and users
12+
The project has received pull requests from many people. Thanks to everyone!
2113

22-
## Dependencies
23-
* Go 1.7 or greater.
24-
* No other dependencies!
14+
Here's some projects that depend on _kin-openapi_:
15+
* [github.com/getkin/kin](https://github.com/getkin/kin) - "A configurable backend"
16+
* [github.com/danielgtaylor/apisprout](https://github.com/danielgtaylor/apisprout) - "Lightweight, blazing fast, cross-platform OpenAPI 3 mock server with validation"
17+
* (Feel free to add your project by [creating an issue](https://github.com/getkin/kin-openapi/issues/new) or a pull request)
2518

26-
## License
27-
* [MIT License](LICENSE)
28-
29-
## Alternatives
19+
## Alternative projects
3020
* [go-openapi](https://github.com/go-openapi)
31-
* Provides a stable and well-tested implementation of OpenAPI version 2.
21+
* Supports OpenAPI version 2.
3222
* See [this list](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/IMPLEMENTATIONS.md).
3323

34-
# Packages
35-
* `jsoninfo`
36-
* Provides information and functions for marshalling/unmarshalling JSON. The purpose is a clutter-free implementation of JSON references and OpenAPI extension properties.
37-
* `openapi2`
38-
* Parses/writes OpenAPI 2.
39-
* `openapi2conv`
40-
* Converts OpenAPI 2 specification into OpenAPI 3 specification.
41-
* `openapi3`
42-
* Parses/writes OpenAPI 3. Includes OpenAPI schema / JSON schema valdation.
43-
* `openapi3filter`
44-
* Validates that HTTP request and HTTP response match an OpenAPI specification file.
45-
* `openapi3gen`
46-
* Generates OpenAPI 3 schemas for Go types.
47-
* `pathpattern`
48-
* Support for OpenAPI style path patterns.
49-
50-
51-
# Getting started
24+
# Structure
25+
* _openapi2_ ([godoc](https://godoc.org/github.com/getkin/kin-openapi/openapi2))
26+
* Support for OpenAPI 2 files, including serialization, deserialization, and validation.
27+
* _openapi2conv_ ([godoc](https://godoc.org/github.com/getkin/kin-openapi/openapi2conv))
28+
* Converts OpenAPI 2 files into OpenAPI 3 files.
29+
* _openapi3_ ([godoc](https://godoc.org/github.com/getkin/kin-openapi/openapi3))
30+
* Support for OpenAPI 3 files, including serialization, deserialization, and validation.
31+
* _openapi3filter_ ([godoc](https://godoc.org/github.com/getkin/kin-openapi/openapi3filter))
32+
* Validates HTTP requests and responses
33+
* _openapi3gen_ ([godoc](https://godoc.org/github.com/getkin/kin-openapi/openapi3gen))
34+
* Generates `*openapi3.Schema` values for Go types.
35+
* _pathpattern_ ([godoc](https://godoc.org/github.com/getkin/kin-openapi/pathpattern))
36+
* Matches strings with OpenAPI path patterns ("/path/{parameter}")
37+
38+
# Some recipes
5239
## Loading OpenAPI document
5340
Use `SwaggerLoader`, which resolves all JSON references:
5441
```go
@@ -96,26 +83,4 @@ func ValidateRequest(req *http.Request) {
9683
})
9784
}
9885

99-
```
100-
101-
## Having extension properties in your own structs
102-
The package `jsoninfo` marshals/unmarshal JSON extension properties (`"x-someExtension"`)
103-
104-
Usage looks like:
105-
```go
106-
type Example struct {
107-
// Allow extension properties ("x-someProperty")
108-
openapi3.ExtensionProps
109-
110-
// Normal properties
111-
SomeField float64
112-
}
113-
114-
func (example *Example) MarshalJSON() ([]byte, error) {
115-
return jsoninfo.MarshalStrictStruct(example)
116-
}
117-
118-
func (example *Example) UnmarshalJSON(data []byte) error {
119-
return jsoninfo.UnmarshalStrictStruct(data, example)
120-
}
121-
```
86+
```

0 commit comments

Comments
 (0)