Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IIIF
backend
Merge requests
!2
Draft:Generic api v1
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Open
Draft:Generic api v1
generic-api-v1
into
master
Overview
0
Commits
18
Pipelines
0
Changes
5
Open
Draft:Generic api v1
David Beniamine
requested to merge
generic-api-v1
into
master
Feb 1, 2023
Overview
0
Commits
18
Pipelines
0
Changes
5
Adds a generic api URIs and models
Prefix path with api version
Generic config
Database initialization
Generic resources
Use generic Model
Auto documentation for parameter
Auto documentation for return values
Generic routes
group
GET
POST
item
GET
POST
PUT
PATCH
DELETE
ORM
tests
test infrastucture and simple exemple
Add data
Test storing data
Work on fake database
Edited
Feb 1, 2023
by
David Beniamine
0
0
Merge request reports
Viewing commit
6ec1a2ad
Prev
Next
Show latest version
5 files
+
42
−
2
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Verified
6ec1a2ad
Merge branch 'swagger' of gitlab.tetras-libre.fr:iiif/backend
· 6ec1a2ad
David Beniamine
authored
Jan 25, 2023
Mirador_backend/resources/mirador_resource.py
+
21
−
1
View file @ 6ec1a2ad
Edit in single-file editor
Open in Web IDE
Show full file
from
flask_restful
import
Resource
from
flask_restful
import
Resource
from
flask_restful_swagger
import
swagger
from
apispec
import
APISpec
from
marshmallow
import
Schema
,
fields
from
apispec.ext.marshmallow
import
MarshmallowPlugin
from
flask_apispec.extension
import
FlaskApiSpec
from
flask_apispec.views
import
MethodResource
from
flask_apispec
import
marshal_with
,
doc
,
use_kwargs
class
MiradorResource
(
Resource
):
class
MRResponseSchema
(
Schema
):
message
=
fields
.
Str
(
default
=
'
Success
'
)
class
MRRequestSchema
(
Schema
):
class
Meta
:
fields
=
(
'
name
'
,
'
description
'
)
# TODO just an example
class
MiradorResource
(
MethodResource
,
Resource
):
@doc
(
description
=
'
Mirador resource i e, manifest and collection of IIIF resource
'
,
tags
=
[
'
Mirador resource
'
])
@marshal_with
(
MRResponseSchema
)
# marshalling
def
get
(
self
,
id
=
None
):
def
get
(
self
,
id
=
None
):
return
{
'
method
'
:
'
get
'
,
'
id
'
:
id
}
return
{
'
method
'
:
'
get
'
,
'
id
'
:
id
}
@doc
(
description
=
'
Create Mirador resource i e, manifest and collection of IIIF resource
'
,
tags
=
[
'
Mirador resource
'
])
@use_kwargs
(
MRRequestSchema
,
location
=
(
'
json
'
))
def
post
(
self
):
def
post
(
self
):
return
{
'
method
'
:
'
post
'
}
return
{
'
method
'
:
'
post
'
}
Loading