Coder Social home page Coder Social logo

extensible-cms / ecms-go-inputfilter Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 55 KB

Input Filter package for validating user submitted inputs with validators (ecms-go-validator and such).

License: MIT License

Go 100.00%
golang go inputfilter filter validator validation ecms

ecms-go-inputfilter's Introduction

ecms-go-inputfilter

Input Filter package for validating user submitted inputs with validators (ecms-go-validator and such).

Docs

See sources (actual docs coming later).

Resources

License

MIT

ecms-go-inputfilter's People

Contributors

elycruz avatar

Watchers

 avatar  avatar

ecms-go-inputfilter's Issues

Create `Input` struct and interface

Acceptance Criteria:

Should have tests for all methods.
Should have tests for all method use cases.

Structs:

  • - Input
  • - Input Result

Interfaces:

  • - Input Interface

Tests:

  • - Input.Validate - Filtering and Obscuration should only occur when validation passes.
    • - Empty Input
    • - Empty Required Input
    • - Input with validator (passing case)
    • - Input with validator (failing case)
    • - Input with validator and filter (passing case)
    • - Input with validator and filter (failing case)
    • - Input with validator, filter, and obscurer (passing case)
    • - Input with validator, filter, and obscurer (failing case)
    • - Input with validator, filter, obscurer, and required prop (passing case)
    • - Input with validator, filter, obscurer, and required prop (failing case)
    • - Input with validator, filter, obscurer, required-messages, and required prop (passing case)
    • - Input with validator, filter, obscurer, required-messages, and required prop (failing case)
    • - Input with validator, filter, obscurer, required-messages, required prop and break-on-failure prop (passing case)
    • - Input with validator, filter, obscurer, required-messages, required prop, and break-on-failure prop (failing case)
  • - Input.AddFilter
  • - Input.AddFilters
  • - Input.AddValidator
  • - Input.AddValidators

`Input.Validate` should only return an `InputResult`

Currently Input.Validate returns (bool, []string, InputResult) however InputResult also contains (bool, []string) via InputResult.Result and InputResult.Messages respectively (hence issue (should only return InputResult (as input result contains much more information than just Result and `Messages)).

Create `InputFilter` struct and interface.

Base struct.

Structs

  • - InputFilter struct.
  • - InputFilterResult struct.

Interfaces

  • -InputFilter Interface

Tests

  • - InputFilter
    • - AddInput
    • - AddInputs
    • - Validate
      • - All valid inputs.
      • - All invalid inputs.
      • - Mix of invalid and valid inputs.
      • - All valid inputs (and breakonfailure flag).
      • - All invalid inputs (and breakonfailure "").
      • - Valid inputs (and breakonfailure "").
      • - Invalid inputs (and breakonfailure flag).

Create initial types and interfaces

Types:

  • - Input
  • - InputResult
  • - InputFilter
  • - InputFilterResult

Interfaces:

  • - Input Interface
  • - InputFilter Interface

Use 'fjl-input-filter' as a reference (has feature complete implementation).

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.