Skip to content

Commit 3917c6c

Browse files
committed
2432: API docs (openapi) update
1 parent 6ff6857 commit 3917c6c

File tree

6 files changed

+170
-1
lines changed

6 files changed

+170
-1
lines changed

.env

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ APP_SECRET=01324d73757787ffeba5f2f76cec1a28
2424

2525
###> app ###
2626
APP_PATH_PREFIX=/api/v2
27+
APP_PROJECT_URI=https://${COMPOSE_DOMAIN}
28+
29+
OPENAPI_TITLE='Event Database'
30+
OPENAPI_DESCRIPTION='API for the Event Database'
31+
OPENAPI_CONTACT_NAME='Contact Name'
32+
OPENAPI_CONTACT_URL='https://github.com/itk-dev/event-database-api/'
33+
OPENAPI_CONTACT_EMAIL='contact@example.org'
34+
OPENAPI_TERMS_OF_SERVICE='https://example.org'
2735

2836
# Must be valid json, usernames and apikeys must be unique
2937
# APP_API_KEYS='[{"username": "user_1", "apikey": "api_key_1"}, {"username": "user_2", "apikey": "api_key_2"}]'
@@ -40,6 +48,7 @@ INDEX_URL=http://elasticsearch:9200
4048
INDEX_EVENTS_ALIAS=events
4149
INDEX_ORGANIZATION_ALIAS=organization
4250
###< INDEX ###
51+
4352
###> nelmio/cors-bundle ###
4453
CORS_ALLOW_ORIGIN='*'
4554
###< nelmio/cors-bundle ###

config/packages/api_platform.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
api_platform:
2-
title: Event database API
2+
title: '%env(OPENAPI_TITLE)%'
3+
description: '%env(OPENAPI_DESCRIPTION)%'
34
version: 2.0.0
45
show_webby: false
56

7+
openapi:
8+
contact:
9+
name: '%env(OPENAPI_CONTACT_NAME)%'
10+
url: '%env(OPENAPI_CONTACT_URL)%'
11+
email: '%env(OPENAPI_CONTACT_EMAIL)%'
12+
termsOfService: '%env(OPENAPI_TERMS_OF_SERVICE)%'
13+
614
formats:
715
jsonld: ['application/ld+json']
816

config/packages/twig.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
twig:
22
default_path: '%kernel.project_dir%/templates'
33

4+
globals:
5+
app_project_uri: '%env(APP_PROJECT_URI)%'
6+
47
when@test:
58
twig:
69
strict_variables: true

public/styles/aak-logo-1.svg

Lines changed: 50 additions & 0 deletions
Loading

public/styles/swagger-ui.css

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/** HEADER **/
2+
3+
header:before {
4+
background: white;
5+
box-shadow: none;
6+
z-index: -100;
7+
}
8+
9+
header {
10+
margin-bottom: -60px;
11+
12+
#logo {
13+
right: 60px;
14+
top: 40px;
15+
position: absolute;
16+
17+
img {
18+
background: none;
19+
}
20+
}
21+
}
22+
23+
.swagger-ui .info a {
24+
font-family: "Arial", "Helvetica", sans-serif;
25+
color: rgb(0, 156, 220);
26+
}
27+
28+
#swagger-ui.api-platform .info .title {
29+
font-family: "Arial", "Helvetica", sans-serif;
30+
color: rgb(66, 66, 66);
31+
}
32+
33+
.swagger-ui .info p {
34+
font-family: "Arial", "Helvetica", sans-serif;
35+
color: rgb(66, 66, 66);
36+
}
37+
38+
.swagger-ui .info > div.info__tos {
39+
position: absolute;
40+
}
41+
42+
.swagger-ui .info > div.info__contact {
43+
position: absolute;
44+
left: 200px;
45+
}
46+
47+
#swagger-ui.api-platform .information-container.wrapper {
48+
height: 140px;
49+
}
50+
51+
.swagger-ui .info > div.info__contact > a.link {
52+
position: absolute;
53+
top: 0;
54+
left: 200px;
55+
width: 200px;
56+
}
57+
58+
#swagger-ui.api-platform .opblock.opblock-get .opblock-summary-method {
59+
background-color: rgb(31, 161, 56);
60+
}
61+
62+
#swagger-ui.api-platform .opblock-section-header, #swagger-ui.api-platform .opblock.opblock-get .opblock-section-header {
63+
background-color: rgb(31, 161, 56, .1);
64+
}
65+
66+
.swagger-ui .btn.authorize {
67+
border-color: rgb(31, 161, 56);
68+
color: rgb(31, 161, 56);
69+
}
70+
71+
#swagger-ui.api-platform .btn.authorize {
72+
background-color: rgb(31, 161, 56, .1);
73+
}
74+
75+
.swagger-ui .btn.authorize svg {
76+
fill: rgb(31, 161, 56);
77+
}
78+
79+
.swagger-ui .info .title small {
80+
background-color: rgb(0, 156, 220);
81+
}
82+
83+
.swagger-ui .info .title small.version-stamp {
84+
background-color: rgb(31, 161, 56);
85+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{% extends "@!ApiPlatform/SwaggerUi/index.html.twig" %}
2+
3+
{% block stylesheet %}
4+
{{ parent() }}
5+
<link rel="stylesheet" href="{{ asset('/api/v2/styles/swagger-ui.css', assetPackage) }}">
6+
{% endblock %}
7+
8+
{% block header %}
9+
<header>
10+
<a id="logo" href="{{ app_project_uri }}">
11+
<img src="{{ asset('/api/v2/styles/aak-logo-1.svg', assetPackage) }}" alt="API Platform">
12+
</a>
13+
</header>
14+
{% endblock %}

0 commit comments

Comments
 (0)