Giter Club home page Giter Club logo

Comments (4)

mbknor avatar mbknor commented on August 12, 2024

Your example looks like it should work. Does it not?

This is the current default mapping - if using html5EnabledSchema:

customType2FormatMapping = Map[String,String](
      // Java7 dates
      "java.time.LocalDateTime" -> "datetime-local",
      "java.time.OffsetDateTime" -> "datetime",
      "java.time.LocalDate" -> "date",

      // Joda-dates
      "org.joda.time.LocalDate" -> "date"
    )

Joda DateTime should probably be added to that list.

from mbknor-jackson-jsonschema.

awanczowski avatar awanczowski commented on August 12, 2024

Hi,

Thanks fro the quick response. It does work appropriately I am actually looking something a bit simpler for the serialization. Our JSON response just outputs ISO timestamps 2017-01-18T19:05:29+00:00. While the JODA DateTime has many parts.

Simple Format:

{
  "DateTime": {
    "type": "string",
    "format": "date-time"
  }
}

Full Serialization:

{
	"DateTime": {
		"type": "object",
		"additionalProperties": false,
		"format": "date-time",
		"properties": {
			"millisOfDay": {
				"type": "integer"
			},
			"monthOfYear": {
				"type": "integer"
			},
			"hourOfDay": {
				"type": "integer"
			},
			"minuteOfHour": {
				"type": "integer"
			},
			"secondOfMinute": {
				"type": "integer"
			},
			"millisOfSecond": {
				"type": "integer"
			},
			"weekOfWeekyear": {
				"type": "integer"
			},
			"weekyear": {
				"type": "integer"
			},
			"yearOfEra": {
				"type": "integer"
			},
			"yearOfCentury": {
				"type": "integer"
			},
			"centuryOfEra": {
				"type": "integer"
			},
			"secondOfDay": {
				"type": "integer"
			},
			"minuteOfDay": {
				"type": "integer"
			},
			"year": {
				"type": "integer"
			},
			"dayOfMonth": {
				"type": "integer"
			},
			"dayOfWeek": {
				"type": "integer"
			},
			"era": {
				"type": "integer"
			},
			"dayOfYear": {
				"type": "integer"
			},
			"chronology": {
				"$ref": "#/definitions/Chronology"
			},
			"zone": {
				"$ref": "#/definitions/DateTimeZone"
			},
			"millis": {
				"type": "integer"
			},
			"afterNow": {
				"type": "boolean"
			},
			"beforeNow": {
				"type": "boolean"
			},
			"equalNow": {
				"type": "boolean"
			}
		},
		"required": ["millisOfDay", "monthOfYear", "hourOfDay", "minuteOfHour", "secondOfMinute", "millisOfSecond", "weekOfWeekyear", "weekyear", "yearOfEra", "yearOfCentury", "centuryOfEra", "secondOfDay", "minuteOfDay", "year", "dayOfMonth", "dayOfWeek", "era", "dayOfYear", "millis", "afterNow", "beforeNow", "equalNow"]
	},
	"Chronology": {
		"type": "object",
		"additionalProperties": false,
		"properties": {
			"zone": {
				"$ref": "#/definitions/DateTimeZone"
			}
		}
	},
	"DateTimeZone": {
		"type": "object",
		"additionalProperties": false,
		"properties": {
			"id": {
				"type": "string"
			},
			"fixed": {
				"type": "boolean"
			}
		},
		"required": ["fixed"]
	}
}

from mbknor-jackson-jsonschema.

mbknor avatar mbknor commented on August 12, 2024

from mbknor-jackson-jsonschema.

awanczowski avatar awanczowski commented on August 12, 2024

You are right, works well now. I forgot to add that line. Thanks again.

from mbknor-jackson-jsonschema.

Related Issues (20)

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.