Skip to content

Commit d969729

Browse files
authored
Merge pull request #1653 from gofr-dev/release/v1.37.1
Release/v1.37.1
2 parents 8ea784b + 034e13d commit d969729

File tree

36 files changed

+872
-303
lines changed

36 files changed

+872
-303
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
name: Bug report
33
about: Create a report to help us improve
44
title: ''
5-
labels: ''
5+
labels: triage
66
assignees: ''
77

88
---
99

10-
1110
**Describe the bug**
1211
A clear and concise description of what the bug is.
1312

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Feature request
33
about: Suggest an idea for this project
44
title: ''
5-
labels: ''
5+
labels: triage
66
assignees: ''
77

88
---

.github/ISSUE_TEMPLATE/question.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ assignees: ''
77

88
---
99

10+

docs/advanced-guide/gofr-errors/page.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,35 @@ func (c customError) LogLevel() logging.Level {
6464
return logging.WARN
6565
}
6666
```
67+
68+
## Extended Error Responses
69+
70+
For [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457.html) style error responses with additional fields, implement the ResponseMarshaller interface:
71+
72+
```go
73+
type ResponseMarshaller interface {
74+
Response() map[string]any
75+
}
76+
```
77+
78+
#### Usage:
79+
```go
80+
type ValidationError struct {
81+
Field string
82+
Message string
83+
Code int
84+
}
85+
86+
func (e ValidationError) Error() string { return e.Message }
87+
func (e ValidationError) StatusCode() int { return e.Code }
88+
89+
func (e ValidationError) Response() map[string]any {
90+
return map[string]any{
91+
"field": e.Field,
92+
"type": "validation_error",
93+
"details": "Invalid input format",
94+
}
95+
}
96+
```
97+
98+
> NOTE: The `message` field is automatically populated from the `Error()` method. Custom fields with the name "message" in the `Response()` map should not be used as they will be ignored in favor of the `Error()` value.

docs/advanced-guide/overriding-default/page.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ Response example:
7272
```
7373

7474
## Rendering Templates
75-
GoFr allows rendering HTML/HTMX templates in handlers using the response.Template type.
75+
GoFr makes it easy to render HTML and HTMX templates directly from your handlers using the response.Template type.
76+
By convention, all template files—whether HTML or HTMX—should be placed inside a templates directory located at the root of your project.
7677

7778
### Example
7879
```go

docs/advanced-guide/websocket/page.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ GoFr allows us to customize the WebSocket upgrader with several options. We can
5151
- `CheckOrigin (WithCheckOrigin)`: Sets a custom origin check function.
5252
- `Compression (WithCompression)`: Enables compression.
5353

54+
## Writing Messages
55+
56+
GoFr provides the `WriteMessageToSocket` method to send messages to the underlying websocket connection in a thread-safe way. The data parameter can be a string, []byte, or any struct that can be marshaled to JSON.
57+
5458
## Example:
5559
We can configure the Upgrader by creating a chain of option functions provided by GoFr.
5660

docs/datasources/dgraph/page.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ database. Any driver that implements the following interface can be added using
66
```go
77
// Dgraph defines the methods for interacting with a Dgraph database.
88
type Dgraph interface {
9+
// ApplySchema applies or updates the complete database schema.
10+
ApplySchema(ctx context.Context, schema string) error
11+
12+
// AddOrUpdateField atomically creates or updates a single field definition.
13+
AddOrUpdateField(ctx context.Context, fieldName, fieldType, directives string) error
14+
15+
// DropField permanently removes a field/predicate and all its associated data.
16+
DropField(ctx context.Context, fieldName string) error
17+
918
// Query executes a read-only query in the Dgraph database and returns the result.
1019
Query(ctx context.Context, query string) (any, error)
1120

examples/grpc/grpc-client/client/health_client.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/grpc/grpc-client/client/hello_client.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/grpc/grpc-server/server/health_gofr.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)