Skip to content

Ci/markdown lint #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lint

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

jobs:
markdownlint:
runs-on: ubuntu-latest
steps:
- name: markdownlint-cli
uses: nosborn/github-action-markdown-cli@v3.3.0
with:
files: .
config_file: .markdownlint.yaml
dot: true
9 changes: 9 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MD001: false

MD010: false

MD013:
code_blocks: false
tables: false

MD033: false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These disabled rules might sound opinionated, mainly because they come without a comment about what they are about and why they are deactivated.

I know markdown lint, and I'm OK with the rules you chose, but I think comments would help

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, we definitely should add a summary about what they are disabling for each one at the very least.

Feel free to do it if you like, if not I’ll slide into my day Monday

Cheers

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could, but I'm not in your head and the reason why you removed might differ from what I think you removed them 😅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened #143

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome thanks, I’ll add you to review Monday.

3 changes: 2 additions & 1 deletion BENCHMARK.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Benchmark against other frameworks

We have benchmarked the API and the performance of Fuego against other popular frameworks. The results are shown below.
We have benchmarked the API and the performance of Fuego against other popular
frameworks. The results are shown below.

## API

Expand Down
14 changes: 10 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Contributing

First of all, if you are reading this, thank you for considering contributing to the project! It's people like you that make it a reality. ❤️
First of all, if you are reading this, thank you for considering contributing to
the project! It's people like you that make it a reality. ❤️

In return, we will do our best to make the contribution process as easy and transparent as possible.
In return, we will do our best to make the contribution process as easy and
transparent as possible.

## How to contribute

There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests or writing code which can be incorporated into the project itself.
There are many ways to contribute, from writing tutorials or blog posts,
improving the documentation, submitting bug reports and feature requests
or writing code which can be incorporated into the project itself.

## Installation

Expand All @@ -20,4 +24,6 @@ There are many ways to contribute, from writing tutorials or blog posts, improvi

## Contributors

Thanks to [everyone who have contributed](https://github.com/go-fuego/fuego/graphs/contributors) to this project!
Thanks to [everyone who have contributed][contributors-url] to this project!

[contributors-url]: https://github.com/go-fuego/fuego/graphs/contributors>
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ fmt:
lint:
go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run

lint-markdown:
markdownlint --fix .

example:
( cd examples/full-app-gourmet && go run . -debug )

Expand All @@ -42,5 +45,5 @@ docs:
docs-open:
go run golang.org/x/pkgsite/cmd/pkgsite@latest -http localhost:8084 -open

.PHONY: docs-open docs example-watch example lint fmt ci ci-full
.PHONY: docs-open docs example-watch example lint lint-markdown fmt ci ci-full
.PHONY: dependencies-analyze build bench cover-web cover test
55 changes: 40 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- markdownlint-disable MD041 -->
<p align="center">
<img src="./data/fuego.svg" height="200" alt="Fuego Logo" />
</p>
Expand All @@ -13,25 +14,42 @@

**Build your API or web application in minutes!**

Go framework generating OpenAPI documentation from code. Inspired by Nest, built for Go developers.
Go framework generating OpenAPI documentation from code.
Inspired by Nest, built for Go developers.

Also empowers `html/template`, `a-h/templ` and `maragudk/gomponents`: see [the example](./examples/full-app-gourmet) - actually running [in prod](https://gourmet.quimerch.com)!
Also empowers `html/template`, `a-h/templ` and `maragudk/gomponents`:
see [the example](./examples/full-app-gourmet) - actually running [in prod](https://gourmet.quimerch.com)!

## Why Fuego?

Chi, Gin, Fiber and Echo are great frameworks. But since they were designed a long time ago, [their current API does not allow them](https://github.com/gin-gonic/gin/issues/155) to deduce OpenAPI types from signatures, things that are now possible with generics. Fuego offers a lot of "modern Go based" features that make it easy to develop APIs and web applications.
Chi, Gin, Fiber and Echo are great frameworks.
But since they were designed a long time ago,
[their current API does not allow them][gin-gonic-issue]
to deduce OpenAPI types from signatures, things that are
now possible with generics. Fuego offers a lot of "modern Go based"
features that make it easy to develop APIs and web applications.

## Features

- **OpenAPI**: Fuego automatically generates OpenAPI documentation from **code** - _not from comments nor yaml files!_
- **`net/http` compatible**: Fuego is built on top of `net/http`, so you can use any `http.Handler` middleware or handler! Fuego also supports `log/slog`, `context` and `html/template`
- **OpenAPI**: Fuego automatically generates OpenAPI documentation
from **code** - _not from comments nor yaml files!_
- **`net/http` compatible**: Fuego is built on top of `net/http`,
so you can use any `http.Handler` middleware or handler! Fuego also supports
`log/slog`, `context` and `html/template`
- **Routing**: Fuego provides a simple API for the Go 1.22 `net/http`
- **Serialization/Deserialization**: Fuego automatically serializes and deserializes JSON, XML and HTML Forms based on user-provided structs (or not, if you want to do it yourself)
- **Serialization/Deserialization**: Fuego automatically serializes and
deserializes JSON, XML and HTML Forms based on user-provided structs
(or not, if you want to do it yourself)
- **Validation**: Fuego provides a simple and fast validator based on `go-playground/validator`
- **Transformation**: easily transform your data by implementing the `fuego.InTransform` and `fuego.OutTransform` interfaces - also useful for **validation**
- **Middlewares**: easily add a custom `net/http` middleware or use the provided middlewares.
- **Error handling**: Fuego provides centralized error handling with the standard [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457).
- **Rendering**: Fuego provides a simple and fast rendering system based on `html/template` - you can still also use your own template system like `templ` or `gomponents`
- **Transformation**: easily transform your data by implementing the
`fuego.InTransform` and `fuego.OutTransform` interfaces - also useful for **validation**
- **Middlewares**: easily add a custom `net/http` middleware
or use the provided middlewares.
- **Error handling**: Fuego provides centralized error handling with
the standard [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457).
- **Rendering**: Fuego provides a simple and fast rendering system based on
`html/template` - you can still also use your own template system like
`templ` or `gomponents`

## Examples

Expand Down Expand Up @@ -121,7 +139,7 @@ func main() {
fuego.Post(s, "/", myController).
Description("This route does something").
Summary("This is my summary").
Tags("MyTag"). // A tag is set by default according to the return type (can be desactivated)
Tags("MyTag"). // A tag is set by default according to the return type (can be deactivated)
Deprecated()

s.Run()
Expand Down Expand Up @@ -245,12 +263,12 @@ curl http://localhost:8088 -X POST -d '{"name": "Fuego"}' -H 'Content-Type: appl

## From net/http to Fuego in 10s

https://github.com/go-fuego/fuego/assets/46993939/7438a71c-75a4-4e88-a584-71da6362c575
<https://github.com/go-fuego/fuego/assets/46993939/7438a71c-75a4-4e88-a584-71da6362c575>

<details>
<summary>Views</summary>

#### Before
### Before

<img width="946" alt="image" src="https://github.com/go-fuego/fuego/assets/46993939/394fed17-a1e2-4b67-89b2-8e6c9eeb771b">

Expand All @@ -273,16 +291,23 @@ https://github.com/go-fuego/fuego/assets/46993939/7438a71c-75a4-4e88-a584-71da63

## Contributing

See the [contributing guide](CONTRIBUTING.md). Thanks to [everyone who has contributed](https://github.com/go-fuego/fuego/graphs/contributors) to this project! ❤️
See the [contributing guide](CONTRIBUTING.md).
Thanks to [everyone who has contributed][contributors-url] to this project! ❤️

## Roadmap

See the [board](https://github.com/orgs/go-fuego/projects/1).

## Disclaimer for experienced gophers

I know you might prefer to use `net/http` directly, but if having a frame can convince my company to use Go instead of Node, I'm happy to use it.
I know you might prefer to use `net/http` directly,
but if having a frame can convince my company to use
Go instead of Node, I'm happy to use it.

## License

[MIT](./LICENSE.txt)

[gin-gonic-issue]: https://github.com/gin-gonic/gin/issues/155

[contributors-url]: https://github.com/go-fuego/fuego/graphs/contributors
32 changes: 18 additions & 14 deletions documentation/README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
This website is built using [Docusaurus](https://docusaurus.io/),
a modern static website generator.

### Installation

```
$ yarn
```sh
yarn
```

### Local Development

```
$ yarn dev
```sh
yarn dev
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
This command starts a local development server and opens up a browser window.
Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```sh
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
This command generates static content into the `build` directory and
can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```sh
USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```sh
GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
If you are using GitHub pages for hosting, this command is a convenient
way to build the website and push to the `gh-pages` branch.
9 changes: 6 additions & 3 deletions documentation/docs/guides/middlewares.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

Fuego supports `net/http` middlewares.

It means that all existing middlewares for `net/http`, including the ones from `chi` and `gorilla` can be used with Fuego! :fire:
It means that all existing middlewares for `net/http`,
including the ones from `chi` and `gorilla` can be used with Fuego! :fire:

You can use them to add functionalities to your routes, such as logging, authentication, etc.
You can use them to add functionalities to your routes, such as logging,
authentication, etc.

## App-level middlewares

Expand Down Expand Up @@ -78,7 +80,8 @@ func main() {

## Route middlewares

You can also add middlewares to a single route. Simply add the middlewares as the last arguments of the route handler:
You can also add middlewares to a single route.
Simply add the middlewares as the last arguments of the route handler:

```go
package main
Expand Down
12 changes: 8 additions & 4 deletions documentation/docs/guides/openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Result for this simple example:

![Swagger UI](../../static/img/hello-world-openapi.png)

The core idea of Fuego is to generate the OpenAPI specification automatically, so you don't have to worry about it. However, you can customize it if you want.
The core idea of Fuego is to generate the OpenAPI specification automatically,
so you don't have to worry about it. However, you can customize it if you want.

## Operations

Expand Down Expand Up @@ -66,7 +67,8 @@ Fuego automatically provides an OpenAPI specification for your API in several wa
- **Swagger UI**
- **JSON endpoint**

Fuego will indicate in a log the paths where the OpenAPI specifications and Swagger UI are available.
Fuego will indicate in a log the paths where the OpenAPI specifications and
Swagger UI are available.

You can customize the paths and to activate or not the feature, with the option `WithOpenAPIConfig`.

Expand Down Expand Up @@ -97,7 +99,8 @@ func main() {

## Custom UI

Fuego `Server` exposes a `UIHandler` field that enables you to implement your custom UI.
Fuego `Server` exposes a `UIHandler` field that enables you
to implement your custom UI.

Example with http swagger:

Expand Down Expand Up @@ -131,7 +134,8 @@ func main() {

The default spec url reference Element Stoplight swagger ui.

Please note that if you embed swagger ui in your build it will increase its size by more than 10Mb.
Please note that if you embed swagger ui in your build it will increase its size
by more than 10Mb.

| | StopLight Elements | Swagger | Disabled |
| ------------- | ------------------ | -------------- | -------- |
Expand Down
6 changes: 5 additions & 1 deletion documentation/docs/guides/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ s := fuego.NewServer(

### CORS

CORS middleware is not registered as a usual middleware, because it applies on routes that aren't registered. For example, `OPTIONS /foo` is not a registered route (only `GET /foo` is registered for example), but it's a request that needs to be handled by the CORS middleware.
CORS middleware is not registered as a usual middleware,
because it applies on routes that aren't registered. For example,
`OPTIONS /foo` is not a registered route
(only `GET /foo` is registered for example),
but it's a request that needs to be handled by the CORS middleware.

```go
import "github.com/rs/cors"
Expand Down
3 changes: 2 additions & 1 deletion documentation/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ Or **try Fuego immediately** by cloning **[one of our exemples](https://github.c

### What you'll need

- [Golang v1.22](https://golang.org/doc/go1.22) or above _(Fuego relies on a new feature of the net/http package only available after 1.22)_.
- [Golang v1.22](https://golang.org/doc/go1.22) or above
_(Fuego relies on a new feature of the net/http package only available after 1.22)_.
6 changes: 4 additions & 2 deletions documentation/docs/tutorials/01-hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ Let's discover **Fuego** in a few lines.

## Quick start

If you don't want to copy/paste the code on your local setup, you can run the following command:
If you don't want to copy/paste the code on your local setup, you can run the
following command:

```bash
go run github.com/go-fuego/fuego/examples/hello-world@latest
```

Useful URLs (including OpenAPI spec & Swagger UI) are given in the terminal: you'll be able to see the result in your browser.
Useful URLs (including OpenAPI spec & Swagger UI) are given in the terminal:
you'll be able to see the result in your browser.

## Start from scratch

Expand Down
6 changes: 4 additions & 2 deletions documentation/docs/tutorials/02-crud.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ fuego controller books
go run github.com/go-fuego/fuego/cmd/fuego@latest controller books
```

After executing the above code, you need to slightly modify the generated controllers/books.go and main.go files.
After executing the above code,
you need to slightly modify the generated controllers/books.go and main.go files.

```go title="controllers/books.go" {8-9,28-39}
package controller
Expand Down Expand Up @@ -95,7 +96,8 @@ The generator will create the following routes:

:::tip

Fuego comes with a [**generator**](#generation) that can generates CRUD routes and controllers for you!
Fuego comes with a [**generator**](#generation)
that can generates CRUD routes and controllers for you!

:::

Expand Down
5 changes: 4 additions & 1 deletion documentation/docs/tutorials/03-hot-reload.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Hot reload

Hot reload is a feature that allows you to update your code and see the changes in real-time without restarting the server. This is very useful for development, as it allows you to see the changes you make to your code immediately.
Hot reload is a feature that allows you to update your code and
see the changes in real-time without restarting the server.
This is very useful for development,
as it allows you to see the changes you make to your code immediately.

To enable hot reload, you need to install the `air` command-line tool:

Expand Down
Loading
Loading