Skip to content

Commit

Permalink
Merge pull request #5 from speakeasy-api/improve-presence
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanSpeakEasy authored Dec 23, 2024
2 parents b952c7d + 28ed22a commit 4296155
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @speakeasy-api/speakeasy-maintainers
Binary file added .github/assets/speakeasy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test-and-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.23"

- name: Install dependencies
run: go mod download

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest

- name: Run tests
run: go test -v ./...

- name: Build
run: go build -v ./...
52 changes: 50 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,59 @@
# github.com/speakeasy-api/openapi
[![https://www.speakeasy.com](.github/assets/speakeasy.png?raw=true)](https://www.speakeasy.com)

# [github.com/speakeasy-api/openapi](https://github.com/speakeasy-api/openapi)

[![Reference](https://godoc.org/github.com/speakeasy-api/openapi?status.svg)](http://godoc.org/github.com/speakeasy-api/openapi)
[![Test](https://github.com/speakeasy-api/openapi/actions/workflows/test.yaml/badge.svg)](https://github.com/speakeasy-api/openapi/actions/workflows/test.yaml)
[![GoReportCard](https://goreportcard.com/badge/github.com/speakeasy-api/openapi)](https://goreportcard.com/report/github.com/speakeasy-api/openapi)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

The Speakeasy OpenAPI module provides a set of packages and tools for working with OpenAPI Specification documents.

Used directly in Speakeasy's products it powers our [SDK Generator](https://www.speakeasy.com/docs/create-client-sdks) and [Contract Testing](https://www.speakeasy.com/docs/testing) tools.

Documentation for the packages can be found in the [GoDoc documentation.](https://pkg.go.dev/github.com/speakeasy-api/openapi)

## Main Packages

### [arazzo](./arazzo)

The `arazzo` package provides an API for working with Arazzo documents including reading, creating, mutating, walking and validating them.
The `arazzo` package provides an API for working with Arazzo documents including reading, creating, mutating, walking and validating them.

## Sub Packages

This repository also contains a number of sub packages that are used by the main packages to provide the required functionality. The below packages may be moved into their own repository in the future, depending on future needs.

### [json](./json)

The `json` package provides utilities for converting between JSON and YAML.

### [jsonpointer](./jsonpointer)

The `jsonpointer` package provides an API for working with [RFC 6901](https://datatracker.ietf.org/doc/html/rfc6901) compliant JSON Pointers. Providing functionality for validating JSON Pointers, and extracting the target of a JSON Pointer for various Go types and structures.

### [jsonschema](./jsonschema)

The `jsonschema` package provides various models for working with the different JSON Schema dialects.

### [sequencedmap](./sequencedmap)

The `sequencedmap` package provides a map implementation that maintains the order of keys as they are added.

## Contributing

This repository is maintained by Speakeasy, but we welcome and encourage contributions from the community to help improve its capabilities and stability.

### How to Contribute

1. **Open Issues**: Found a bug or have a feature suggestion? Open an issue to describe what you'd like to see changed.

2. **Pull Requests**: We welcome pull requests! If you'd like to contribute code:
- Fork the repository
- Create a new branch for your feature/fix
- Submit a PR with a clear description of the changes and any related issues

3. **Feedback**: Share your experience using the packages or suggest improvements.

All contributions, whether they're bug reports, feature requests, or code changes, help make this project better for everyone.

Please ensure your contributions adhere to our coding standards and include appropriate tests where applicable.
28 changes: 27 additions & 1 deletion arazzo/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# github.com/speakeasy-api/openapi/arazzo
[![https://www.speakeasy.com](../.github/assets/speakeasy.png?raw=true)](https://www.speakeasy.com)

# [github.com/speakeasy-api/openapi/arazzo](https://github.com/speakeasy-api/openapi/arazzo)

[![Reference](https://godoc.org/github.com/speakeasy-api/openapi/arazzo?status.svg)](http://godoc.org/github.com/speakeasy-api/openapi/arazzo)
[![Test](https://github.com/speakeasy-api/openapi/actions/workflows/test.yaml/badge.svg)](https://github.com/speakeasy-api/openapi/actions/workflows/test.yaml)
[![GoReportCard](https://goreportcard.com/badge/github.com/speakeasy-api/openapi)](https://goreportcard.com/report/github.com/speakeasy-api/openapi)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

The Arazzo package provides an API for working with Arazzo documents including reading, creating, mutating, walking and validating them.

Expand Down Expand Up @@ -199,3 +206,22 @@ func main() {
}
}
```

## Contributing

This repository is maintained by Speakeasy, but we welcome and encourage contributions from the community to help improve its capabilities and stability.

### How to Contribute

1. **Open Issues**: Found a bug or have a feature suggestion? Open an issue to describe what you'd like to see changed.

2. **Pull Requests**: We welcome pull requests! If you'd like to contribute code:
- Fork the repository
- Create a new branch for your feature/fix
- Submit a PR with a clear description of the changes and any related issues

3. **Feedback**: Share your experience using the packages or suggest improvements.

All contributions, whether they're bug reports, feature requests, or code changes, help make this project better for everyone.

Please ensure your contributions adhere to our coding standards and include appropriate tests where applicable.
2 changes: 1 addition & 1 deletion arazzo/expression/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func getType(expression string) ([]string, ExpressionType) {
return expressionParts, typ
}

// TODO the spec is currently ambiguous on how to handle any additional dot seperated parts after the name so just treat as a name for now
// TODO the spec is currently ambiguous on how to handle any additional dot separated parts after the name so just treat as a name for now
// TODO there is probably something required to handle dots within a key name
func validateName(expression, name, referenceType string) error {
parts := strings.Split(name, ".")
Expand Down
16 changes: 8 additions & 8 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"
)

// ErrSeperator is used to seperate the message from the cause in the error message
const ErrSeperator = " -- "
// ErrSeparator is used to separate the message from the cause in the error message
const ErrSeparator = " -- "

// Error provides a string based error type allowing the definition of const errors in packages
type Error string
Expand All @@ -17,12 +17,12 @@ func (s Error) Error() string {
return string(s)
}

// Is checks if targer error is equivelant to Error
// Is checks if target error is equivalent to Error
func (s Error) Is(target error) bool {
return s.Error() == target.Error() || strings.HasPrefix(target.Error(), s.Error()+ErrSeperator)
return s.Error() == target.Error() || strings.HasPrefix(target.Error(), s.Error()+ErrSeparator)
}

// As will set target errors value to equal Error if they are equivelant
// As will set target errors value to equal Error if they are equivalent
func (s Error) As(target interface{}) bool {
v := reflect.ValueOf(target).Elem()
if v.Type().Name() == "Error" && v.CanSet() {
Expand All @@ -44,7 +44,7 @@ type wrappedError struct {

func (w wrappedError) Error() string {
if w.cause != nil {
return fmt.Sprintf("%s%s%v", w.msg, ErrSeperator, w.cause)
return fmt.Sprintf("%s%s%v", w.msg, ErrSeparator, w.cause)
}
return w.msg
}
Expand All @@ -63,12 +63,12 @@ func (w wrappedError) Unwrap() error {

// The below are just wrappers as we are stealing the namespace of the errors package

// Is checks if err is equivelant to target
// Is checks if err is equivalent to target
func Is(err error, target error) bool {
return errors.Is(err, target)
}

// As will set target errors value to equal Error if they are equivelant
// As will set target errors value to equal Error if they are equivalent
func As(err error, target any) bool {
return errors.As(err, target)
}
Expand Down

0 comments on commit 4296155

Please sign in to comment.