Skip to content

Overriding Models data types not working #359

Closed
@rartavia

Description

@rartavia

I have a very simple model with a java.util.Calendar property, I want to present this as a simple string with date as a format (Similar to what we get with java.util.Date).

I tried what we have in the documentation https://github.com/wordnik/swagger-core/wiki/overriding-models#in-java-with-swagger-core-version-13x

... But it didn't work

My converter looks like this

public class Converter
{
  public void registerConverter()
  {
    String jsonString = "{" +
            "  \"id\": \"Calendar\"," +
            "  \"properties\": {" +
            "    \"value\": {" +
            "      \"required\": true," +
            "      \"description\": \"Date in ISO-8601 format\"," +
            "      \"notes\": \"Add any notes you like here\"," +
            "      \"type\": \"string\"," +
            "      \"format\": \"date-time\"" +
            "    }" +
            "  }" +
            "}";
    OverrideConverter converter = new OverrideConverter();
    converter.add("java.util.Calendar", jsonString);
  }
}

I'm initializing the converter using Spring, I wonder if that's sufficient and if it is, why is not working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions