fieldmask

Field Mask

License

License

MIT
Categories

Categories

Auto Application Layer Libs Code Generators config Configuration
GroupId

GroupId

ma.ju.fieldmask
ArtifactId

ArtifactId

fieldmask-boot-autoconfigure
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

pom
Description

Description

fieldmask
Field Mask
Project URL

Project URL

https://github.com/stevejuma/fieldmask
Source Code Management

Source Code Management

https://github.com/stevejuma/fieldmask

Download fieldmask-boot-autoconfigure

How to add to project

<!-- https://jarcasting.com/artifacts/ma.ju.fieldmask/fieldmask-boot-autoconfigure/ -->
<dependency>
    <groupId>ma.ju.fieldmask</groupId>
    <artifactId>fieldmask-boot-autoconfigure</artifactId>
    <version>1.0.0</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/ma.ju.fieldmask/fieldmask-boot-autoconfigure/
implementation 'ma.ju.fieldmask:fieldmask-boot-autoconfigure:1.0.0'
// https://jarcasting.com/artifacts/ma.ju.fieldmask/fieldmask-boot-autoconfigure/
implementation ("ma.ju.fieldmask:fieldmask-boot-autoconfigure:1.0.0")
'ma.ju.fieldmask:fieldmask-boot-autoconfigure:pom:1.0.0'
<dependency org="ma.ju.fieldmask" name="fieldmask-boot-autoconfigure" rev="1.0.0">
  <artifact name="fieldmask-boot-autoconfigure" type="pom" />
</dependency>
@Grapes(
@Grab(group='ma.ju.fieldmask', module='fieldmask-boot-autoconfigure', version='1.0.0')
)
libraryDependencies += "ma.ju.fieldmask" % "fieldmask-boot-autoconfigure" % "1.0.0"
[ma.ju.fieldmask/fieldmask-boot-autoconfigure "1.0.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Documentation

Maven Central

Requirements and Downloads

Requirements:

  • Java 1.8
  • Spring Framework Boot > 2.x.x (web)

Gradle:

repositories {
    mavenCentral()
}

dependencies {
  // If using the core library only
  implementation 'ma.ju.fieldmask:fieldmask-core:1.0.1'
  // If using Spring Boot
  implementation 'ma.ju.fieldmask:fieldmask-starter:1.0.1'
  // If using Spring MVC
  implementation 'ma.ju.fieldmask:fieldmask-spring:1.0.1'
}

FieldMask

Fieldmask is a framework for supporting partial JSON responses in
RESTful web services by allowing users to supply arbitrary queries in the URL.

Fieldmask supports partial responses in the following web frameworks:

  • Spring Boot
  • SpringMVC

What is a partial response?

By default, the server will send back the full representation of a rest resource for every request. Partial responses let you request only the elements you are interested in, instead of the full resource representation.

This allows your client application to avoid transferring, parsing, and storing unneeded fields, so you can utilize network and memory resources more efficiently.

For example, take the two responses below. Both are requests for the
same resource, but let's assume we are only interested in the following fields:

  • Artist Name
  • Album Count
  • Album Names

Full Resource Representation

{
  "id": "12345",
  "name": "Avril Lavigne",
  "albumCount": 2,
  "songCount": 24,
  "albums": [
    {
        "id": "45678",
        "title": "Let Go",
        "artistId": "12345",
        "releaseDate": "2002-06-04"        
    }
  ],
  "songs": [
     {
       "id": "98765",
       "title": "Complicated",
       "albumId": 45678
     }
  ]
}

Partial Resource Representation

https://fieldmask.ju.ma/artists/12345?fields=name,albumCount,albums(title)

{
  "name": "Avril Lavigne",
  "albumCount": 2,
  "albums": [
    { 
        "title": "Let Go"     
    }
  ]
}

As you can see, the partial response is a significant reduction in payload size and message complexity. By allowing the consumer of the API to specify the fields they are interested in you can significantly reduce the complexity of response messages as well as improve performance over the wire.

Getting FieldMask

Catnap libraries are available from JCenter.

  • fieldmask-core - Use this library if you are only interested in the fieldmask masking functionality
  • fieldmask-spring - Configuration for use with spring MVC
  • fieldmask-starter - Use this library if you are integrating fieldmask with spring boot

Versions

Version
1.0.0