-
Notifications
You must be signed in to change notification settings - Fork 55
Conversation
how did you generate openapi.yaml file? |
Thank you for the PR, @atsushii I am weighing the tradeoff of managing this API file separately, as opposed to using annotations like https://github.com/swaggo/swag Annotations have the benefit of being next to the API code, which I think will have the effect of keeping the docs more up to date, and also simpler to read - since you can see the API exposed by looking at the code. I looked at stoplight but the documentation is a bit sparse. It's most important that we're able to keep these docs up to date and easy to read. What do you think? |
@decentralgabe |
I have fixed my code to generate spec yaml by annotations using https://github.com/swaggo/swag Please review it! |
thank you @atsushii this looks really good. I will take a more in depth look after the weekend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor changes - looks good!
cmd/main.go
Outdated
// @title Swagger Example API | ||
// @version 1.0 | ||
// @description This is a sample server celler server. | ||
// @termsOfService http://swagger.io/terms/ | ||
|
||
// @contact.name API Support | ||
// @contact.url http://www.swagger.io/support | ||
// @contact.email [email protected] | ||
|
||
// @license.name Apache 2.0 | ||
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html | ||
|
||
// @host localhost:8080 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// @title Swagger Example API | |
// @version 1.0 | |
// @description This is a sample server celler server. | |
// @termsOfService http://swagger.io/terms/ | |
// @contact.name API Support | |
// @contact.url http://www.swagger.io/support | |
// @contact.email [email protected] | |
// @license.name Apache 2.0 | |
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html | |
// @host localhost:8080 | |
// @title SSI Service API | |
// @version 0.1 | |
// @description https://github.com/TBD54566975/ssi-service | |
// @contact.name TBD | |
// @contact.url https://github.com/TBD54566975/ssi-service/issues | |
// @contact.email [email protected] | |
// @license.name Apache 2.0 | |
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html | |
// @host localhost:8080 |
pkg/server/router/credential.go
Outdated
@@ -62,6 +63,17 @@ type CreateCredentialResponse struct { | |||
Credential credsdk.VerifiableCredential `json:"credential"` | |||
} | |||
|
|||
// ShowAccount godoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ShowAccount godoc | |
// CreateCredential godoc |
pkg/server/router/credential.go
Outdated
@@ -87,6 +99,16 @@ type GetCredentialResponse struct { | |||
Credential credsdk.VerifiableCredential `json:"credential"` | |||
} | |||
|
|||
// ShowAccount godoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ShowAccount godoc | |
// GetCredential godoc |
pkg/server/router/credential.go
Outdated
@@ -113,7 +135,19 @@ type GetCredentialsResponse struct { | |||
Credentials []credsdk.VerifiableCredential `json:"credentials"` | |||
} | |||
|
|||
// GetCredentials checks for the presence of a query parameter and calls the associated filtered get method | |||
// ShowAccount godoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ShowAccount godoc | |
// GetCredentials godoc |
pkg/server/router/credential.go
Outdated
@@ -174,6 +208,17 @@ func (cr CredentialRouter) getCredentialsBySchema(schema string, ctx context.Con | |||
return framework.Respond(ctx, w, resp, http.StatusOK) | |||
} | |||
|
|||
// ShowAccount godoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ShowAccount godoc | |
// DeleteCredential godoc |
pkg/server/router/health.go
Outdated
@@ -14,7 +15,14 @@ const ( | |||
HealthOK string = "OK" | |||
) | |||
|
|||
// Health is a simple handler that always responds with a 200 OK | |||
// ShowAccount godoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ShowAccount godoc | |
// Health godoc |
pkg/server/router/health.go
Outdated
// ShowAccount godoc | ||
// @Summary Health Check | ||
// @Description Health is a simple handler that always responds with a 200 OK | ||
// @Tags NewSSIServer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what purpose does the tag server here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fix it to HealthCheck, thanks!
pkg/server/router/readiness.go
Outdated
@@ -23,8 +24,15 @@ type GetReadinessResponse struct { | |||
ServiceStatuses map[svcframework.Type]svcframework.Status `json:"serviceStatuses"` | |||
} | |||
|
|||
// ready runs a number of application specific checks to see if all the | |||
// relied upon service are healthy. Should return a 500 if not ready. | |||
// ShowAccount godoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ShowAccount godoc | |
// Readiness godoc |
pkg/server/router/schema.go
Outdated
@@ -40,6 +41,17 @@ type CreateSchemaResponse struct { | |||
Schema schemalib.VCJSONSchema `json:"schema"` | |||
} | |||
|
|||
// ShowAccount godoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ShowAccount godoc | |
// CreateSchema godoc |
pkg/server/router/schema.go
Outdated
@@ -79,6 +100,16 @@ type GetSchemaResponse struct { | |||
Schema schemalib.VCJSONSchema `json:"schema,omitempty"` | |||
} | |||
|
|||
// ShowAccount godoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ShowAccount godoc | |
// GetSchemaByID godoc |
docs/.swaggo
Outdated
@@ -0,0 +1,2 @@ | |||
// TODO: read cryptosuite.LDKeyType from sdk properly | |||
skip github.com/TBD54566975/ssi-sdk/did.VerificationMethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be solved before merge, what error did you run into?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@decentralgabe
ParseComment error in file {path to did.go} :cannot find type definition: cryptosuite.LDKeyType
the above error occurred when I ran swag init cmd.
Seems cannot read LDKeyType which define inside ssi-sdk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably need to fix the type definition in ssi-sdk..
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me take a look. do you mind if I push to the branch if I find a solution?
hi @atsushii I created a PR against your branch here that fixes the issues. if you merge this into your branch, I believe this PR should update automatically: atsushii#1 |
Hi @decentralgabe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome job, thank you for your contribution!
Addresses #9
What I did
Please check the doc!
step
1, mage run
2, access to http://localhost:8002/docs