docs added

This commit is contained in:
darius 2024-05-16 18:12:02 +02:00
parent 02e50b4cc8
commit 4e0cddc643
15 changed files with 99 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import (
"encoding/json"
"github.com/a-h/rest"
"log"
"net/http"
"os"
)
@ -14,6 +15,14 @@ func main() {
api = rest.NewAPI("portfolio")
api.StripPkgPaths = []string{"github.com/a-h/rest/example", "github.com/a-h/respond"}
api.Get("/nfc/{uid}").
HasPathParameter("uid", rest.PathParam{
Description: "id of the user",
Regexp: `\d+`,
}).
HasDescription("Get nfc data by uid.").
HasResponseModel(http.StatusOK, rest.ModelOf[string]())
// Create the specification.
spec, err := api.Spec()
if err != nil {

29
common/docs/Dockerfile Normal file
View File

@ -0,0 +1,29 @@
FROM golang:latest as openApiGen
ADD . .
RUN go run ./api/docs/openAPI
FROM registry.jetbrains.team/p/writerside/builder/writerside-builder:241.15989 as build
ARG INSTANCE=Writerside/portfolio
RUN mkdir /opt/sources
WORKDIR /opt/sources
COPY --from=openApiGen /go/common/docs/openApi.json ./Writerside
ADD ./common/docs ./Writerside
RUN export DISPLAY=:99 && \
Xvfb :99 & \
/opt/builder/bin/idea.sh helpbuilderinspect -source-dir /opt/sources --product $INSTANCE --runner other --output-dir /opt/wrs-output/
WORKDIR /opt/wrs-output
RUN unzip webHelpPORTFOLIO2-all.zip -d /opt/wrs-output/unzipped-artifact
FROM httpd:2.4 as http-server
COPY --from=build /opt/wrs-output/unzipped-artifact/ /usr/local/apache2/htdocs/

View File

@ -1,9 +1,42 @@
{
"components": {},
"info": {
"title": "messages",
"title": "portfolio",
"version": "0.0.0"
},
"openapi": "3.0.0",
"paths": {}
"paths": {
"/nfc/{uid}": {
"get": {
"description": "Get nfc data by uid.",
"parameters": [
{
"description": "id of the user",
"in": "path",
"name": "uid",
"required": true,
"schema": {
"pattern": "\\d+",
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
},
"description": ""
},
"default": {
"description": ""
}
}
}
}
}
}

View File

@ -4,6 +4,11 @@
<instance-profile id="portfolio"
name="portfolio"
>
start-page="test.md">
<toc-element topic="test.md"/>
<toc-element topic="API_Reference.md">
<toc-element topic="Schemas.md"/>
<toc-element topic="nfc_uid_GET.md"/>
</toc-element>
</instance-profile>

View File

@ -0,0 +1,3 @@
# Schemas
Start typing here...

View File

@ -0,0 +1,3 @@
# /nfc/{uid} GET
<api-endpoint openapi-path="../../openApi.json" method="GET" endpoint="/nfc/{uid}"/>

View File

@ -0,0 +1,3 @@
# test
Start typing here...

View File

@ -1,3 +1,3 @@
package ent
//go:generate go run -mod=mod entgo.io/ent/cmd/ent generate ./schema
//go:generate go run entgo.io/ent/cmd/ent generate ./schema

View File

@ -24,3 +24,13 @@ services:
database:
condition: service_healthy
docs:
build: .
ports:
- "4003:80"
restart: unless-stopped
image: docker.dariusklein.nl/portfolio:latest
depends_on:
database:
condition: service_healthy