How to define schema for Map<String, String> #207
              
                
                  
                  
                    Answered
                  
                  by
                    gregsdennis
                  
              
          
                  
                    
                      venkatpselvam1
                    
                  
                
                  asked this question in
                Q&A
              
            -
| 
         I have a simple java dictionary as HashMap<String, String>. The sample json will look like the below format. The no of elements in the dict may be zero or more. The values are not complex object the are simple strings. How can I write a validator for this?  | 
  
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            gregsdennis
          
      
      
        Jul 25, 2022 
      
    
    Replies: 2 comments
-
| 
         The keyword you want is  {
  "type": "object",
  "additionalProperties": {
    "type": "string"
  }
}This keyword will validate any properties that don't appear in   | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        handrews
-
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
The keyword you want is
additionalProperties.{ "type": "object", "additionalProperties": { "type": "string" } }This keyword will validate any properties that don't appear in
propertiesorpatternProperties.