Skip to content

Commit

Permalink
Merge pull request #13 from jsightapi/rc/5.0
Browse files Browse the repository at this point in the history
Rc/5.0
  • Loading branch information
andrew-platonov authored Oct 18, 2022
2 parents c0afb33 + 6cdd2d9 commit 891303e
Show file tree
Hide file tree
Showing 242 changed files with 9,967 additions and 5,648 deletions.
20 changes: 19 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2.1

orbs:
docker: circleci/[email protected]
common: jsight/[email protected].5
common: jsight/[email protected].7
jira: circleci/[email protected]

parameters:
Expand Down Expand Up @@ -31,6 +31,7 @@ workflows:
env: dev
image: jsight/dev-jsight-server:<< pipeline.parameters.image-tag >>
notification-message: Dev JSight-Server updated from branch ${CIRCLE_BRANCH} (commit ${CIRCLE_SHA1})
trigger-mark: 'pipe << pipeline.number >>'
post-steps:
- jira/notify:
job_type: deployment
Expand Down Expand Up @@ -94,6 +95,23 @@ workflows:
environment: Production


crazy:
when:
equal: [ crazy, << pipeline.git.branch >> ]
jobs:
- docker/publish:
<<: *base-publish
tag: '<< pipeline.parameters.image-tag >>'
- common/trigger-deployment:
<<: *base-trigger
env: crazy
notification-message: Crazy Jsight-Server updated from branch ${CIRCLE_BRANCH} (commit ${CIRCLE_SHA1})
post-steps:
- jira/notify:
job_type: deployment
environment_type: testing
environment: Experimental

ci_test:
when:
equal: [ ci_separate_deploy, << pipeline.git.branch >> ]
Expand Down
3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
Expand All @@ -96,13 +95,11 @@ linters:
- noctx
- nolintlint
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace

# don't enable:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18-alpine as builder
FROM golang:1.19-alpine as builder

WORKDIR /go/src/github.com/jsightapi/jsight-server
COPY . .
Expand Down
147 changes: 137 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,25 @@ various tasks related to processing the JSight API language.
**JSight API language** – you've never designed API so fast. We mean it. [Compare JSight with Open
API](#scroll--jsight-api-language).

Supported standards: [HTTP REST](#scroll--jsight-api-language), [JSON-RPC 2.0](#json-rpc-20-new-feature).

Currently, the **JSight Server API** allows you to perform only one task:

1. Parsing code in the JSight API language, which results in a JSON structure containing all
information about this API in the *JDoc Exchange Format*.

The following features are also planned in the near future:

1. Converting from JSight API to OpenAPI.
2. Converting from OpenAPI to JSight API.
3. API documentation generation in MarkDown format.
4. API documentation generation in PDF format.
5. Generation of API server code stubs for different programming languages ​​(Java, PHP, Go,
1. Support for other types of API: gRPC, Kafka, RabbitMQ, WebSocket.
2. Converting from JSight API to OpenAPI.
3. Converting from OpenAPI to JSight API.
4. API documentation generation in MarkDown format.
5. API documentation generation in PDF format.
6. Generation of API server code stubs for different programming languages ​​(Java, PHP, Go,
Node.js, Python, C++ etc.).
6. Generation of API clients for different programming languages ​​(JavaScript, Java, PHP, Go,
7. Generation of API clients for different programming languages ​​(JavaScript, Java, PHP, Go,
Python, C++ etc.).
7. And many other features.
8. And many other features.

> :fire: If you have any ideas or suggestions, please share with us:
>
Expand Down Expand Up @@ -385,8 +388,8 @@ For more information on configuring the JSight Server, see the

## :scroll: &nbsp; JSight API language

The JSight API language allows you to specify REST APIs with incredible speed and convenience. More
information can be found in the [Quick
The JSight API language allows you to specify REST and JSON-RPC APIs with incredible speed and
convenience. More information can be found in the [Quick
Tutorial](https://jsight.io/docs/jsight-api-0-3-quick-tutorial) or in the [language
specification](https://jsight.io/docs/jsight-api-0-3). Here we give examples of the same API
described using JSight API and OpenAPI.
Expand Down Expand Up @@ -1535,6 +1538,130 @@ We did not describe this API in OpenAPI. It is too complicated and very long…

</details>

#### JSON-RPC 2.0. New Feature!

<details><summary>Example 9. JSON-RPC 2.0</summary>

<table align="center">
<thead>
<tr>
<th width="50%">
JSight API 0.3
</th>
<th>
OpenRPC 1.2.1
</th>
</tr>
</thead>
<tbody>
<tr valign="top">
<td>

```
JSIGHT 0.3
URL /
Protocol json-rpc-2.0
Method listPets // List all pets
Params
[
20 // Limit (how many items to return).
]
Result
[ // An array of pets
{ // Pet
"id": 123,
"name": "Tom"
}
]
```

The JSON-RPC API is as simple to describe as the REST API.

More about JSON-RPC 2.0 support: [Quick Tutorial. JSON-RPC 2.0
support](https://jsight.io/docs/jsight-api-0-3-quick-tutorial/lesson10).

<div align="center">

:star: **Star us on GitHub — it motivates us a lot!**

</div>

</td>
<td>

```
{
"openrpc": "1.2.1",
"info": {
"version": "",
"title": ""
},
"methods": [
{
"name": "listPets",
"description": "List all pets",
"params": [
{
"name": "limit",
"description": "How many items to return",
"schema": {
"type": "integer"
}
}
],
"result": {
"name": "pets",
"description": "An array of pets",
"schema": {
"type": "array",
"items": {
"title": "Pet",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
}
}
},
"examples": [
{
"name": "listPetExample",
"description": "List pet example",
"params": [
{
"name": "limit",
"value": 20
}
],
"result": {
"name": "listPetResultExample",
"value": [
{
"id": 123,
"name": "Tom"
}
]
}
}
]
}
]
}
```

</td>
</tr>
</tbody>
</table>

</details>

<div>
&nbsp;
</div>
Expand Down Expand Up @@ -1770,4 +1897,4 @@ We sincerely thank all those without whom this project would not have been possi

:star: **Star us on GitHub — it motivates us a lot!** :star:

</div>
</div>
2 changes: 1 addition & 1 deletion error_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func newErrorInfo(e error) errorInfo {
Message: e.Error(),
}

var je *jerr.JAPIError
var je *jerr.JApiError

if errors.As(e, &je) {
r.Line = int(je.Line())
Expand Down
2 changes: 1 addition & 1 deletion error_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func Test_newErrorInfo(t *testing.T) {
},

"JAPI error": {
jerr.NewJAPIError("fake error", fs.NewFile("foo", []byte("123")), 2),
jerr.NewJApiError("fake error", fs.NewFile("foo", []byte("123")), 2),
errorInfo{
Status: "Error",
Message: "fake error",
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/jsightapi/jsight-server

go 1.18
go 1.19

require (
github.com/jsightapi/datagram v0.0.0-20220518133429-389893b2d914
github.com/jsightapi/jsight-api-go-library v1.0.0
github.com/jsightapi/jsight-schema-go-library v1.0.0
github.com/jsightapi/datagram v0.0.0-20220623160954-98dd8ec27707
github.com/jsightapi/jsight-api-go-library v1.0.1-0.20221003140528-d0bec831f71d
github.com/jsightapi/jsight-schema-go-library v1.0.1-0.20221003140029-c68c810f065f
github.com/stretchr/testify v1.7.0
)

Expand Down
28 changes: 6 additions & 22 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/jsightapi/datagram v0.0.0-20220518133429-389893b2d914 h1:KTR7IMQRFjObHteQQOnRUpBX9vfmdhTfgbTrDwgCqhs=
github.com/jsightapi/datagram v0.0.0-20220518133429-389893b2d914/go.mod h1:pBj2DBaAOdg5nWXc09jm6IUQnaE4iKMY1tvsx3RmchY=
github.com/jsightapi/jsight-api-go-library v0.3.1-0.20220518151514-b13543d9118c h1:AW7gWElsC4vTvtJt4a/F2Uql3N6k8HGQ4qwp5Qmn2/Q=
github.com/jsightapi/jsight-api-go-library v0.3.1-0.20220518151514-b13543d9118c/go.mod h1:LrLy9Y9Ndd7RSebzdVfJ0VDtnmPAHHs1op98R8XyF1E=
github.com/jsightapi/jsight-api-go-library v0.3.1-0.20220606110524-c2cb7338ce24 h1:9VI9TV2AucqIkKrk7u01g9+8bDEMFIZUYM8KEmO38jk=
github.com/jsightapi/jsight-api-go-library v0.3.1-0.20220606110524-c2cb7338ce24/go.mod h1:LrLy9Y9Ndd7RSebzdVfJ0VDtnmPAHHs1op98R8XyF1E=
github.com/jsightapi/jsight-api-go-library v0.3.1-0.20220608143202-5aaf13dd4c61 h1:/eGUXEHuOBCto8sxlaLWOBXM5f5MYXdbPrRHdZLtSDA=
github.com/jsightapi/jsight-api-go-library v0.3.1-0.20220608143202-5aaf13dd4c61/go.mod h1:VJX6QuLo3OkzXJm9Sp6Mlnp87uWpubd7uxu6/CWZBtU=
github.com/jsightapi/jsight-api-go-library v0.3.1-0.20220609105634-66dacc8fb482 h1:Yoi+kYl+9irvtBLOI8iT3GJHaYTIM7fENYldfsh3tO8=
github.com/jsightapi/jsight-api-go-library v0.3.1-0.20220609105634-66dacc8fb482/go.mod h1:VJX6QuLo3OkzXJm9Sp6Mlnp87uWpubd7uxu6/CWZBtU=
github.com/jsightapi/jsight-api-go-library v0.3.1-0.20220615115655-75385d7e0710 h1:xVNoi5W6paluOO5w9rr/tRTUkrBwJJ+lehDefqW3wBs=
github.com/jsightapi/jsight-api-go-library v0.3.1-0.20220615115655-75385d7e0710/go.mod h1:8UjFwluFsKBmT2NyxDhA/iwm4++QwrG3Bs31s122m8g=
github.com/jsightapi/jsight-api-go-library v1.0.0 h1:9rnhKHBS7dCogyxY3SR1NnghdA5Z2G4+LSMsl7DmK48=
github.com/jsightapi/jsight-api-go-library v1.0.0/go.mod h1:Pae4M/sz5vGK1+gxpTW9XTk8KHmVXbZKU5nZmJfLB1s=
github.com/jsightapi/jsight-schema-go-library v0.3.1-0.20220518141303-90f81f34b796 h1:w7DcC0xJFlot4sCOs5im9PXXVPVmk+liAtp8J/f4Z1U=
github.com/jsightapi/jsight-schema-go-library v0.3.1-0.20220518141303-90f81f34b796/go.mod h1:OO00XD+yMOCPSWZy3EpsknpHKL9U67CeAuFwTThJk4w=
github.com/jsightapi/jsight-schema-go-library v0.3.1-0.20220608142925-ffc7adb01d28 h1:s5sh4VErEhfGiNbgedtsAqcYvLQFbL3PgxRqPSJMXCw=
github.com/jsightapi/jsight-schema-go-library v0.3.1-0.20220608142925-ffc7adb01d28/go.mod h1:OO00XD+yMOCPSWZy3EpsknpHKL9U67CeAuFwTThJk4w=
github.com/jsightapi/jsight-schema-go-library v0.3.1-0.20220610155950-d0680a0b271b h1:9b0+ksbP39Zp7lN8Mv/MKrzB4NwyuzrecfEhsZmV4+o=
github.com/jsightapi/jsight-schema-go-library v0.3.1-0.20220610155950-d0680a0b271b/go.mod h1:OO00XD+yMOCPSWZy3EpsknpHKL9U67CeAuFwTThJk4w=
github.com/jsightapi/jsight-schema-go-library v1.0.0 h1:LgvwT61R3oqJ4TGyz7+AApvFIJaMeMFrBbLKsPNuPPw=
github.com/jsightapi/jsight-schema-go-library v1.0.0/go.mod h1:OO00XD+yMOCPSWZy3EpsknpHKL9U67CeAuFwTThJk4w=
github.com/jsightapi/datagram v0.0.0-20220623160954-98dd8ec27707 h1:DvpMxaeajafsBn3NVjcaloatbqupVaIdcV4y8KHunI8=
github.com/jsightapi/datagram v0.0.0-20220623160954-98dd8ec27707/go.mod h1:pBj2DBaAOdg5nWXc09jm6IUQnaE4iKMY1tvsx3RmchY=
github.com/jsightapi/jsight-api-go-library v1.0.1-0.20221003140528-d0bec831f71d h1:YwZC99fp5wuSgJqvscZxFMeWGKc1oVAQjWjVrjWjxCQ=
github.com/jsightapi/jsight-api-go-library v1.0.1-0.20221003140528-d0bec831f71d/go.mod h1:7oWngIOMoaPdw/LagNrLLz0q34iseuzh/2XQ0991UIk=
github.com/jsightapi/jsight-schema-go-library v1.0.1-0.20221003140029-c68c810f065f h1:EplsddRyGiinnEwgY5gbbIPN1z+5PNMiPptCLv8uSV4=
github.com/jsightapi/jsight-schema-go-library v1.0.1-0.20221003140029-c68c810f065f/go.mod h1:5xAFmTG3k1xbav+r/ASsktndWbEB/nZFeZ5y2hYgCGU=
github.com/lucasjones/reggen v0.0.0-20200904144131-37ba4fa293bb h1:w1g9wNDIE/pHSTmAaUhv4TZQuPBS6GV3mMz5hkgziIU=
github.com/lucasjones/reggen v0.0.0-20200904144131-37ba4fa293bb/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
2 changes: 1 addition & 1 deletion http_response_200.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func httpResponse200(w http.ResponseWriter, b []byte) {
w.Header().Set("Content-Type", "application/json")
w.Header().Set("X-Jdoc-Exchange-File-Schema-Version", catalog.JDocExchangeFileSchemaVersion)
w.Header().Set("X-Jdoc-Exchange-Version", catalog.JDocExchangeVersion)
n, _ := fmt.Fprint(w, string(b))

log.Printf("... Ok (%d bytes)", n)
Expand Down
4 changes: 2 additions & 2 deletions http_response_200_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Test_httpResponse200(t *testing.T) {
assert.Equal(t, http.StatusOK, r.Code)
assert.Len(t, r.Header(), 2)
assert.Equal(t, "application/json", r.Header().Get("Content-Type"))
assert.Equal(t, catalog.JDocExchangeFileSchemaVersion, r.Header().Get("X-Jdoc-Exchange-File-Schema-Version"))
assert.Equal(t, catalog.JDocExchangeVersion, r.Header().Get("X-Jdoc-Exchange-Version"))
assert.Equal(t, content, r.Body.String())
})

Expand All @@ -32,7 +32,7 @@ func Test_httpResponse200(t *testing.T) {
assert.Equal(t, http.StatusOK, r.Code)
assert.Len(t, r.Header(), 2)
assert.Equal(t, "application/json", r.Header().Get("Content-Type"))
assert.Equal(t, catalog.JDocExchangeFileSchemaVersion, r.Header().Get("X-Jdoc-Exchange-File-Schema-Version"))
assert.Equal(t, catalog.JDocExchangeVersion, r.Header().Get("X-Jdoc-Exchange-Version"))
assert.Equal(t, "", r.Body.String())
})
})
Expand Down
Loading

0 comments on commit 891303e

Please sign in to comment.