Git Product home page Git Product logo

simplediff's Introduction

Simple Diff

Description

Simple ASP.NET Core 6.0 API that compares two inputs (more details in the assignment here). Uses MSSQL database to store inputs, docker compose file attached for MSSQL image.

Solution includes an integration test project that uses InMemoryDatabase, here you can test the API without using MSSQL. Also includes a test project for internal logic with fake data.

Docker Scripts

MSSQL Image download and run

docker-compose up -d

MSSQL Image stop

docker-compose down

Limitations

  • Input has a length restriction [StringLength(500)]

  • I don't check if one input is already in the DB and I don't inform the user

  • User has to wait for the difference result, Api could have a background queue to compare inputs and store results in DB

  • Class DbInitialiser always deletes the schema and creates a new one (we can comment ensure methods and uncomment the migrate method)

The Assignment

Provide 2 HTTP endpoints that accepts base64-encoded JSON of following format

  • /v1/diff//left
  • example: curl -X POST "/v1/diff//left" -H "accept: /" -H "Content-Type: application/custom" -d ""eyJpbnB1dCI6InRlc3RWYWx1ZSJ9""
  • /v1/diff//right
  • example: curl -X POST "/v1/diff//right" -H "accept: /" -H "Content-Type: application/custom" - d ""eyJpbnB1dCI6InRlc3RWYWx1ZSJ9""

The provided JSON data needs to be diff-ed and the results shall be available on a third end point

  • /v1/diff/

The results shall provide the following info in JSON format ( structure is up to you)

  • If value of the "input" property of diffed JSONs is equal, just return that information saying “inputs were equal”. No need to return compared values.
  • If value of the "input" property of diffed JSONs is not of equal size, just return that information “inputs are of different size”. No need to return compared values.
  • If value of the "input" property of diffed JSONs has the same size, perform a simple diff - return offsets (in both values of the "input" property) and lengths (in both values of the "input" property) of the differences.

Must haves

  • Solution written in C# - strongly preferred is to use .NET CORE ( NET 6.0 )
  • Provide a test client (can be command line, integration test …..) to call the API
  • Documentation in code
  • Describe limitations of the solution

simplediff's People

Contributors

ave1995 avatar

Watchers

 avatar

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.