Code Monkey home page Code Monkey logo

forma's People

Contributors

kamilsk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

forma's Issues

support accept header

parse:

Accept: text/html

Accept: image/*

Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8
/* TODO for GetV1
supported := map[string]string{
	"json": "application/json",
	//"toml": "application/toml",
	//"xml":  "application/xml",
	//"yaml": "application/yaml",
}
format := strings.ToLower(req.URL.Query().Get("format"))
if format == "" {
	format = "json"
}
ct, ok := supported[format]
if !ok {
	http.Error(rw, "Unsupported output format.", http.StatusUnsupportedMediaType)
	return
}
rw.Header().Set("Content-Type", ct)
fmt.Fprintf(rw, "get form schema in format %q with Content-Type %q", format, ct)
*/

add feedback section

## Feedback

[![@kamilsk](https://img.shields.io/badge/author-%40ikamilsk-blue.svg)](https://twitter.com/ikamilsk)
[![@octolab](https://img.shields.io/badge/sponsor-%40octolab-blue.svg)](https://twitter.com/octolab_inc)

## Notes

- made with โค๏ธ by [OctoLab](https://www.octolab.org/)

schema.Apply

var data url.Values = request.PostForm()
filtered := schema.Apply(data)
validated := schema.Validate(filtered)

schema.Validate

Continue of issue #29

var data url.Values = request.PostForm()
filtered := schema.Apply(data)
validated := schema.Validate(filtered)

code quality problems

cmd/root.go:14:5:warning: exported var RootCmd should have comment or be unexported (golint)
dao/layer.go:15:36:warning: exported func Must returns unexported type *dao.layer, which can be annoying to use (golint)
dao/layer.go:24:36:warning: exported func New returns unexported type *dao.layer, which can be annoying to use (golint)
dao/layer_test.go:96:12:warning: ineffectual assignment to err (ineffassign)
dao/postgres/postgres.go:36:25:warning: uuid can be fmt.Stringer (interfacer)
errors/error.go:11:2:warning: exported const ServerError should have comment (or a comment on this block) or be unexported (golint)
errors/error.go:17:64:warning: exported func NotFound returns unexported type *errors.withCode, which can be annoying to use (golint)
errors/error.go:22:66:warning: exported func Validation returns unexported type *errors.withCode, which can be annoying to use (golint)
errors/error.go:27:64:warning: exported func Database returns unexported type *errors.withCode, which can be annoying to use (golint)
errors/error.go:32:69:warning: exported func Serialization returns unexported type *errors.withCode, which can be annoying to use (golint)
errors/error.go:6:2:warning: exported const ResourceNotFound should have comment (or a comment on this block) or be unexported (golint)
server/error.go:67:1:warning: comment on exported method Error.InvalidReferer should be of the form "InvalidReferer ..." (golint)
server/error.go:77:1:warning: exported method Error.FromGetV1 should have comment or be unexported (golint)
server/middleware.go:13:14:warning: next can be http.Handler (interfacer)
server/middleware.go:35:34:warning: error return value not checked (err.NotProvidedUUID().MarshalTo(rw)) (errcheck)
server/middleware.go:39:30:warning: error return value not checked (err.InvalidUUID().MarshalTo(rw)) (errcheck)
server/server.go:19:34:warning: exported func New returns unexported type *server.server, which can be annoying to use (golint)
server/server.go:37:46:warning: error return value not checked (httpErr.FromGetV1(response.Error).MarshalTo(rw)) (errcheck)
server/server.go:40:12:warning: error return value not checked (enc.Encode(response.Schema)) (errcheck)
server/server.go:50:41:warning: error return value not checked (httpErr.InvalidFormData(err).MarshalTo(rw)) (errcheck)
server/server.go:56:32:warning: error return value not checked (httpErr.NoReferer().MarshalTo(rw)) (errcheck)
server/server.go:62:40:warning: error return value not checked (httpErr.InvalidReferer(err).MarshalTo(rw)) (errcheck)
service/service.go:6:25:warning: exported func New returns unexported type *service.formAPI, which can be annoying to use (golint)
static/static.go:101:6:warning: func staticTemplateErrorHtml should be staticTemplateErrorHTML (golint)
static/static.go:72:5:warning: don't use underscores in Go names; var _staticMigrations1_initialSql should be _staticMigrations1InitialSQL (golint)
static/static.go:74:6:warning: don't use underscores in Go names; func staticMigrations1_initialSqlBytes should be staticMigrations1InitialSQLBytes (golint)
static/static.go:81:6:warning: don't use underscores in Go names; func staticMigrations1_initialSql should be staticMigrations1InitialSQL (golint)
static/static.go:92:5:warning: var _staticTemplateErrorHtml should be _staticTemplateErrorHTML (golint)
static/static.go:94:6:warning: func staticTemplateErrorHtmlBytes should be staticTemplateErrorHTMLBytes (golint)

need to create separate tasks for all packages

add target for stress test

$ make stress-test

semaphore create 2
semaphore add -- curl -O http://user:pass@localhost:8080/debug/
semaphore add -- hey -cpu=2 localhost:8080/api/v1/{schema}
semaphore wait

errors package

current work with errors not optimal:

  • need to identify which error is a client and which is a server
  • HTML rendering
  • integrate with pkg/errors

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.