-
-
Notifications
You must be signed in to change notification settings - Fork 18
Adiciona endpoint para publicar datasets #45
Adiciona endpoint para publicar datasets #45
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Muito obrigado pelo interesse no projeto, ficou ótimo! Tô mandando algumas correçõeszinhas pequenas, algumas @JoseRenan até já tinha comentado. No mais, ficou muito bom mesmo.
laguinho/models/metadata.py
Outdated
@@ -0,0 +1,21 @@ | |||
from marshmallow import Schema, fields, pprint, validate | |||
|
|||
def get_required_error(attribute): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seria bom colocar isso em outro arquivo dentro do models/, porque outros schemas podem usar
laguinho/models/metadata.py
Outdated
validate=validate.OneOf(["json", "csv"]), | ||
required=True, | ||
error_messages=get_required_error("format")) | ||
contributable = fields.Bool() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Poderia inicializar o schema logo aqui depois da classe:
dataset_metadata = DatasetMetadataSchema()
pra não precisar ficar instanciando quando for usar, é OK ter o schema como um singleton
laguinho/routes/datasets.py
Outdated
@@ -0,0 +1,17 @@ | |||
from flask import Blueprint, request, jsonify | |||
from laguinho.models.metadata import DatasetMetadataSchema |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
já importar a instancia do schema, invés da classe como sugerido na outra issue
laguinho/routes/datasets.py
Outdated
|
||
@datasets.route("/datasets", methods=['GET']) | ||
def get_datasets(): | ||
return jsonify(datasets_metadata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
não dá pra usar o schema aqui também? pra gente padronizar uma forma só de parse pra JSON?
…ue possa ser usada de forma global
…que possa ser usada de forma global
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Topppp meu patrão, mto bom msm!!! Valeu ❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Show de bola!
Resolve #43
Adiciona endpoint para publicar datasets e salva os JSON em memória
Forma de testar:
Fazer um post no endpoint
http://localhost:8080/datasets/publish
com um exemplo de metadata no body.Para testar o que está sendo salvo basta fazer um get para o endpoint
http://localhost:8080/datasets/metadata