Skip to content

Commit

Permalink
revise rest api
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiasac committed Oct 18, 2024
1 parent 7c81ae6 commit 4de5c45
Show file tree
Hide file tree
Showing 33 changed files with 7,419 additions and 3,783 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ go 1.23.0
toolchain go1.23.1

require (
github.com/google/uuid v1.6.0
github.com/hasura/ndc-rest/ndc-rest-schema v0.2.5
github.com/hasura/ndc-sdk-go v1.5.2-0.20241013153211-ca0e28914f0c
github.com/hasura/ndc-sdk-go v1.5.2-0.20241013164146-0bf9f9a9ab8c
github.com/lmittmann/tint v1.0.5
go.opentelemetry.io/otel v1.31.0
go.opentelemetry.io/otel/trace v1.31.0
Expand All @@ -27,7 +28,6 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/invopop/jsonschema v0.12.0 // indirect
github.com/klauspost/compress v1.17.11 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I=
github.com/hasura/ndc-sdk-go v1.5.2-0.20241013153211-ca0e28914f0c h1:C+2uejHoZbaU7AuVGP3xCaT+l0HPA6Mgvcu1E5eqbLA=
github.com/hasura/ndc-sdk-go v1.5.2-0.20241013153211-ca0e28914f0c/go.mod h1:oik0JrwuN5iZwZjZJzIRMw9uO2xDJbCXwhS1GgaRejk=
github.com/hasura/ndc-sdk-go v1.5.2-0.20241013164146-0bf9f9a9ab8c h1:t6Cff9qFRMecdgzs4/V26A3rofaIQK/Hc2OZ9O66HcM=
github.com/hasura/ndc-sdk-go v1.5.2-0.20241013164146-0bf9f9a9ab8c/go.mod h1:oik0JrwuN5iZwZjZJzIRMw9uO2xDJbCXwhS1GgaRejk=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
Expand Down
2 changes: 1 addition & 1 deletion ndc-rest-schema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.23.1
require (
github.com/alecthomas/kong v1.2.1
github.com/evanphx/json-patch v0.5.2
github.com/hasura/ndc-sdk-go v1.5.2-0.20241013153211-ca0e28914f0c
github.com/hasura/ndc-sdk-go v1.5.2-0.20241013164146-0bf9f9a9ab8c
github.com/invopop/jsonschema v0.12.0
github.com/lmittmann/tint v1.0.5
github.com/pb33f/libopenapi v0.18.3
Expand Down
4 changes: 2 additions & 2 deletions ndc-rest-schema/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/hasura/ndc-sdk-go v1.5.2-0.20241013153211-ca0e28914f0c h1:C+2uejHoZbaU7AuVGP3xCaT+l0HPA6Mgvcu1E5eqbLA=
github.com/hasura/ndc-sdk-go v1.5.2-0.20241013153211-ca0e28914f0c/go.mod h1:oik0JrwuN5iZwZjZJzIRMw9uO2xDJbCXwhS1GgaRejk=
github.com/hasura/ndc-sdk-go v1.5.2-0.20241013164146-0bf9f9a9ab8c h1:t6Cff9qFRMecdgzs4/V26A3rofaIQK/Hc2OZ9O66HcM=
github.com/hasura/ndc-sdk-go v1.5.2-0.20241013164146-0bf9f9a9ab8c/go.mod h1:oik0JrwuN5iZwZjZJzIRMw9uO2xDJbCXwhS1GgaRejk=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
Expand Down
107 changes: 107 additions & 0 deletions ndc-rest-schema/jsonschema/convert-config.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/hasura/ndc-rest/ndc-rest-schema/command/convert-config",
"$ref": "#/$defs/ConvertConfig",
"$defs": {
"ConvertConfig": {
"properties": {
"file": {
"type": "string",
"description": "File path needs to be converted"
},
"spec": {
"$ref": "#/$defs/SchemaSpecType",
"description": "The API specification of the file, is one of oas3 (openapi3), oas2 (openapi2)"
},
"methodAlias": {
"additionalProperties": {
"type": "string"
},
"type": "object",
"description": "Alias names for HTTP method. Used for prefix renaming, e.g. getUsers, postUser"
},
"prefix": {
"type": "string",
"description": "Add a prefix to the function and procedure names"
},
"trimPrefix": {
"type": "string",
"description": "Trim the prefix in URL, e.g. /v1"
},
"envPrefix": {
"type": "string",
"description": "The environment variable prefix for security values, e.g. PET_STORE"
},
"pure": {
"type": "boolean",
"description": "Return the pure NDC schema only"
},
"strict": {
"type": "boolean",
"description": "Require strict validation"
},
"patchBefore": {
"items": {
"$ref": "#/$defs/PatchConfig"
},
"type": "array",
"description": "Patch files to be applied into the input file before converting"
},
"patchAfter": {
"items": {
"$ref": "#/$defs/PatchConfig"
},
"type": "array",
"description": "Patch files to be applied into the input file after converting"
},
"allowedContentTypes": {
"items": {
"type": "string"
},
"type": "array",
"description": "Allowed content types. All content types are allowed by default"
},
"output": {
"type": "string",
"description": "The location where the ndc schema file will be generated. Print to stdout if not set"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"file"
],
"description": "ConvertConfig represents the content of convert config file"
},
"PatchConfig": {
"properties": {
"path": {
"type": "string"
},
"strategy": {
"type": "string",
"enum": [
"merge",
"json6902"
]
}
},
"additionalProperties": false,
"type": "object",
"required": [
"path",
"strategy"
]
},
"SchemaSpecType": {
"type": "string",
"enum": [
"oas3",
"oas2",
"openapi3",
"openapi2",
"ndc"
]
}
}
}
Loading

0 comments on commit 4de5c45

Please sign in to comment.