I just tried to create a Java for my JSON Swagger file within the Swagger Editor.
Unfortunately nothing happens if I try to generate the client.
In the Dev-Tools console of Chrome I can see an exception but I do not have any idea what went wrong and where to find more detailed information.
POST https://generator.swagger.io/api/gen/clients/java 500 (Request failed.)
index.js:1 Uncaught (in promise) Error: Request failed.
at index.js:1
at tryCatch (runtime.js:62)
at Generator.invoke [as _invoke] (runtime.js:296)
at Generator.e.(/anonymous function) [as next] (https://editor.swagger.io/dist/swagger-editor-standalone-preset.js:1:104152)
at step (asyncToGenerator.js:17)
at asyncToGenerator.js:28
This is the JSON file used to generated the Java client:
{
"swagger":"2.0",
"info":{
"description":"REST API zur Anlage und Modifikation der Daten",
"title":"Aktivierung / Aktualisierung / Deaktivierung der Daten",
"version":"1"
},
"host":"myhost.server.local:8080",
"basePath":"/metadata-webapp",
"paths":{
"/metadata/deactivate":{
"put":{
"summary":"Metadata Deactivation",
"description":"",
"operationId":"deactivate",
"consumes":[
"application/json"
],
"produces":[
"application/json"
],
"parameters":[
{
"in":"body",
"name":"body",
"description":"metadata key",
"required":true,
"schema":{
"$ref":"#/definitions/MetadataKey"
}
}
],
"responses":{
"200":{
"description":"Request was processed"
},
"400":{
"description":"Bad Request, falls Validierung auf Request Objekt fehlschlägt"
},
"500":{
"description":"Interner Fehler"
}
}
}
},
"/metadata/individual":{
"post":{
"summary":"\tMetadata Insert Individual",
"description":"",
"operationId":"saveIndividual",
"consumes":[
"application/json"
],
"produces":[
"application/json"
],
"parameters":[
{
"in":"body",
"name":"body",
"description":"metadata",
"required":true,
"schema":{
"$ref":"#/definitions/MetadataIndividualInsert"
}
}
],
"responses":{
"200":{
"description":"OK"
},
"400":{
"description":"Invalid Metadata",
"schema":{
"$ref":"#/definitions/MetadataResponse"
}
},
"404":{
"description":"Not found",
"schema":{
"type":"string"
}
},
"405":{
"description":"Method Not Allowed",
"schema":{
"$ref":"#/definitions/MetadataResponse"
}
},
"409":{
"description":"Conflict",
"schema":{
"$ref":"#/definitions/MetadataResponse"
}
},
"500":{
"description":"Internal Server Error"
}
}
},
"put":{
"summary":"Metadata Update Individual",
"description":"",
"operationId":"updateIndividual",
"consumes":[
"application/json"
],
"produces":[
"application/json"
],
"parameters":[
{
"in":"body",
"name":"body",
"description":"metadata",
"required":true,
"schema":{
"$ref":"#/definitions/MetadataUpdate"
}
}
],
"responses":{
"200":{
"description":"Request was processed"
},
"400":{
"description":"Bad Request, falls Validierung auf Request Objekt fehlschlägt"
},
"500":{
"description":"Interner Fehler"
}
}
}
},
"/metadata":{
"post":{
"summary":"\tMetadata Insert",
"description":"",
"operationId":"save",
"consumes":[
"application/json"
],
"produces":[
"application/json"
],
"parameters":[
{
"in":"body",
"name":"body",
"description":"metadata",
"required":true,
"schema":{
"$ref":"#/definitions/MetadataInsert"
}
}
],
"responses":{
"200":{
"description":"OK"
},
"400":{
"description":"Invalid Metadata",
"schema":{
"$ref":"#/definitions/MetadataResponse"
}
},
"404":{
"description":"Not found",
"schema":{
"type":"string"
}
},
"405":{
"description":"Method Not Allowed",
"schema":{
"$ref":"#/definitions/MetadataResponse"
}
},
"409":{
"description":"Conflict",
"schema":{
"$ref":"#/definitions/MetadataResponse"
}
},
"500":{
"description":"Internal Server Error"
}
}
},
"put":{
"summary":"Metadata Update",
"description":"",
"operationId":"update",
"consumes":[
"application/json"
],
"produces":[
"application/json"
],
"parameters":[
{
"in":"body",
"name":"body",
"description":"metadata",
"required":true,
"schema":{
"$ref":"#/definitions/MetadataUpdate"
}
}
],
"responses":{
"200":{
"description":"Request was processed"
},
"400":{
"description":"Bad Request, falls Validierung auf Request Objekt fehlschlägt"
},
"500":{
"description":"Interner Fehler"
}
}
}
}
},
"definitions":{
"MetadataKey":{
"type":"object",
"required":[
"itemId"
],
"properties":{
"itemId":{
"type":"string",
"minLength":1,
"maxLength":36
},
"itemCode":{
"type":"string",
"minLength":0,
"maxLength":10
}
}
},
"MetadataResponse":{
"type":"object",
"required":[
"itemId"
],
"properties":{
"itemId":{
"type":"string",
"minLength":1,
"maxLength":36
},
"itemCode":{
"type":"string",
"minLength":0,
"maxLength":10
},
"returnCode":{
"type":"string",
"enum":[
"OK",
"FAULT",
"IRRELEVANT",
"STATUS",
"TECHNICAL_ERROR"
]
},
"message":{
"type":"string"
}
}
},
"MetadataUpdate":{
"type":"object",
"required":[
"aType",
"codeFrom",
"iType",
"isCodeRangeNumeric",
"lengthOfCodes",
"numberOfCodes",
"oCategory",
"itemId",
"myExtraIds",
"status",
"targetCategory",
"validDays",
"validFrom",
"validUntil"
],
"properties":{
"itemId":{
"type":"string",
"minLength":1,
"maxLength":36
},
"itemCode":{
"type":"string",
"minLength":0,
"maxLength":10
},
"uuid":{
"type":"string"
},
"validFrom":{
"type":"string",
"format":"date-time",
"example":"yyyy-MM-dd'T'HH:mm:ssZ"
},
"validUntil":{
"type":"string",
"format":"date-time",
"example":"yyyy-MM-dd'T'HH:mm:ssZ"
},
"validUntilOriginal":{
"type":"string",
"format":"date-time"
},
"validDays":{
"type":"integer",
"format":"int32"
},
"visibleFrom":{
"type":"string",
"format":"date-time",
"example":"yyyy-MM-dd'T'HH:mm:ssZ"
},
"visibleTo":{
"type":"string",
"format":"date-time",
"example":"yyyy-MM-dd'T'HH:mm:ssZ"
},
"aType":{
"type":"integer",
"format":"int32",
"description":"OFFLINE(1),ONLINE(2),BOTH(3)"
},
"multiRedeem":{
"type":"integer",
"format":"int32",
"minimum":1,
"maximum":2147483647
},
"targetCategory":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"iType":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"oCategory":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"incentiveValueFrom":{
"type":"integer",
"format":"int32"
},
"incentiveValueTo":{
"type":"integer",
"format":"int32"
},
"externalID":{
"type":"string"
},
"couponID":{
"type":"string"
},
"codeFrom":{
"type":"string",
"minLength":1,
"maxLength":2147483647
},
"codeTo":{
"type":"string"
},
"infoText":{
"type":"string"
},
"status":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"numberOfCodes":{
"type":"integer",
"format":"int32",
"minimum":1,
"maximum":2147483647
},
"lengthOfCodes":{
"type":"integer",
"format":"int32",
"minimum":4,
"maximum":2147483647
},
"isCodeRangeNumeric":{
"type":"boolean"
},
"interfaceOrigin":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"myExtraIds":{
"type":"array",
"items":{
"type":"string"
},
"maxItems":2147483647,
"minItems":1
}
}
},
"MetadataIndividualInsert":{
"type":"object",
"required":[
"aType",
"codeFrom",
"iType",
"isCodeRangeNumeric",
"lengthOfCodes",
"numberOfCodes",
"oCategory",
"itemId",
"myExtraIds",
"status",
"targetCategory",
"validDays",
"validFrom",
"validUntil"
],
"properties":{
"itemId":{
"type":"string",
"minLength":1,
"maxLength":36
},
"itemCode":{
"type":"string",
"minLength":0,
"maxLength":10
},
"uuid":{
"type":"string"
},
"validFrom":{
"type":"string",
"format":"date-time",
"example":"yyyy-MM-dd'T'HH:mm:ssZ"
},
"validUntil":{
"type":"string",
"format":"date-time",
"example":"yyyy-MM-dd'T'HH:mm:ssZ"
},
"validUntilOriginal":{
"type":"string",
"format":"date-time"
},
"validDays":{
"type":"integer",
"format":"int32"
},
"visibleFrom":{
"type":"string",
"format":"date-time",
"example":"yyyy-MM-dd'T'HH:mm:ssZ"
},
"visibleTo":{
"type":"string",
"format":"date-time",
"example":"yyyy-MM-dd'T'HH:mm:ssZ"
},
"aType":{
"type":"integer",
"format":"int32",
"description":"OFFLINE(1),ONLINE(2),BOTH(3)"
},
"multiRedeem":{
"type":"integer",
"format":"int32",
"minimum":1,
"maximum":2147483647
},
"targetCategory":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"iType":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"oCategory":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"incentiveValueFrom":{
"type":"integer",
"format":"int32"
},
"incentiveValueTo":{
"type":"integer",
"format":"int32"
},
"externalID":{
"type":"string"
},
"couponID":{
"type":"string"
},
"codeFrom":{
"type":"string",
"minLength":1,
"maxLength":2147483647
},
"codeTo":{
"type":"string"
},
"infoText":{
"type":"string"
},
"status":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"numberOfCodes":{
"type":"integer",
"format":"int32",
"minimum":1,
"maximum":2147483647
},
"lengthOfCodes":{
"type":"integer",
"format":"int32",
"minimum":4,
"maximum":2147483647
},
"isCodeRangeNumeric":{
"type":"boolean"
},
"interfaceOrigin":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"myExtraIds":{
"type":"array",
"items":{
"type":"string"
},
"maxItems":2147483647,
"minItems":1
}
}
},
"MetadataInsert":{
"type":"object",
"required":[
"aType",
"codeFrom",
"iType",
"isCodeRangeNumeric",
"lengthOfCodes",
"numberOfCodes",
"oCategory",
"itemId",
"myExtraIds",
"status",
"targetCategory",
"validDays",
"validFrom",
"validUntil"
],
"properties":{
"itemId":{
"type":"string",
"minLength":1,
"maxLength":36
},
"itemCode":{
"type":"string",
"minLength":0,
"maxLength":10
},
"uuid":{
"type":"string"
},
"validFrom":{
"type":"string",
"format":"date-time",
"example":"yyyy-MM-dd'T'HH:mm:ssZ"
},
"validUntil":{
"type":"string",
"format":"date-time",
"example":"yyyy-MM-dd'T'HH:mm:ssZ"
},
"validUntilOriginal":{
"type":"string",
"format":"date-time"
},
"validDays":{
"type":"integer",
"format":"int32"
},
"visibleFrom":{
"type":"string",
"format":"date-time",
"example":"yyyy-MM-dd'T'HH:mm:ssZ"
},
"visibleTo":{
"type":"string",
"format":"date-time",
"example":"yyyy-MM-dd'T'HH:mm:ssZ"
},
"aType":{
"type":"integer",
"format":"int32",
"description":"OFFLINE(1),ONLINE(2),BOTH(3)"
},
"multiRedeem":{
"type":"integer",
"format":"int32",
"minimum":1,
"maximum":2147483647
},
"targetCategory":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"iType":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"oCategory":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"incentiveValueFrom":{
"type":"integer",
"format":"int32"
},
"incentiveValueTo":{
"type":"integer",
"format":"int32"
},
"externalID":{
"type":"string"
},
"couponID":{
"type":"string"
},
"codeFrom":{
"type":"string",
"minLength":1,
"maxLength":2147483647
},
"codeTo":{
"type":"string"
},
"infoText":{
"type":"string"
},
"status":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"numberOfCodes":{
"type":"integer",
"format":"int32",
"minimum":1,
"maximum":2147483647
},
"lengthOfCodes":{
"type":"integer",
"format":"int32",
"minimum":4,
"maximum":2147483647
},
"isCodeRangeNumeric":{
"type":"boolean"
},
"interfaceOrigin":{
"type":"integer",
"format":"int32",
"description":"desc"
},
"myExtraIds":{
"type":"array",
"items":{
"type":"string"
},
"maxItems":2147483647,
"minItems":1
}
}
}
}
}
Does anybody can give my a hint what to do or where to look at?
The issue is caused by a very large maxItems value in array definitions in the spec:
"maxItems":2147483647
It causes an out-of-memory error in Swagger Codegen, see this issue for details.
The workaround is to remove maxItems from your spec.
Related
I'm trying to get the submitted data from a slack modal payload (using Integromat) but I'm unable to match the fields as the field names (block_ids) and random and change on each submission.
Not sure where to start, is there something on the Slack side I can do to stop this or how can I handle this in Integromat?
Payload below:
{
"blocks":[
{
"type":"header",
"block_id":"GH6Wh",
"text":{
"type":"plain_text",
"text":"AHome",
"emoji":true
}
},
{
"type":"input",
"block_id":"ayv5",
"label":{
"type":"plain_text",
"text":"Project Title",
"emoji":true
},
"optional":false,
"dispatch_action":false,
"element":{
"type":"plain_text_input",
"action_id":"field_project_title",
"dispatch_action_config":{
"trigger_actions_on":[
"on_enter_pressed"
]
}
}
},
{
"type":"input",
"block_id":"4Tf7",
"label":{
"type":"plain_text",
"text":"Client Project Contacts",
"emoji":true
},
"optional":false,
"dispatch_action":false,
"element":{
"type":"multi_static_select",
"action_id":"client_project_contacts",
"placeholder":{
"type":"plain_text",
"text":"Select",
"emoji":true
},
"options":[
{
"text":{
"type":"plain_text",
"text":"jennifer",
"emoji":true
},
"value":"47dht5f-1942-4448-9842-20fef64dcd67"
}
]
}
},
{
"type":"divider",
"block_id":"a=6G"
},
{
"type":"section",
"block_id":"qtq0W",
"text":{
"type":"mrkdwn",
"text":"Project Start",
"verbatim":false
},
"accessory":{
"type":"datepicker",
"action_id":"field_project_start_date",
"initial_date":"2022-01-19",
"placeholder":{
"type":"plain_text",
"text":"Select a date",
"emoji":true
}
}
},
{
"type":"section",
"block_id":"4YOTI",
"text":{
"type":"mrkdwn",
"text":"Project Finish",
"verbatim":false
},
"accessory":{
"type":"datepicker",
"action_id":"field_project_end_date",
"initial_date":"2022-03-19",
"placeholder":{
"type":"plain_text",
"text":"Select a date",
"emoji":true
}
}
},
{
"type":"divider",
"block_id":"MZU"
},
{
"type":"input",
"block_id":"v09",
"label":{
"type":"plain_text",
"text":"Project Manager",
"emoji":true
},
"optional":false,
"dispatch_action":false,
"element":{
"type":"static_select",
"action_id":"field_project_managers",
"placeholder":{
"type":"plain_text",
"text":"Select",
"emoji":true
},
"options":[
{
"text":{
"type":"plain_text",
"text":"Eric ",
"emoji":true
},
"value":"b85ba51b-2346-481f-98a8-2b94fh994575"
}
]
}
},
{
"type":"input",
"block_id":"gxN9",
"label":{
"type":"plain_text",
"text":"Project Team",
"emoji":true
},
"optional":false,
"dispatch_action":false,
"element":{
"type":"multi_static_select",
"action_id":"field_project_team",
"placeholder":{
"type":"plain_text",
"text":"Select",
"emoji":true
},
"options":[
]
}
},
{
"type":"divider",
"block_id":"CU1k"
},
{
"type":"input",
"block_id":"ows",
"label":{
"type":"plain_text",
"text":"Setup apps",
"emoji":true
},
"optional":true,
"dispatch_action":false,
"element":{
"type":"checkboxes",
"action_id":"setup_apps",
"options":[
{
"text":{
"type":"plain_text",
"text":"Harvest",
"emoji":true
},
"value":"setup_harvest"
},
{
"text":{
"type":"plain_text",
"text":"Dropbox Project Folder",
"emoji":true
},
"value":"setup_dropbox"
}
]
}
},
{
"type":"divider",
"block_id":"Eov"
}
],
"private_metadata":"",
"callback_id":"_project_setup_form_submit",
"state":{
"values":{
"ayv5":{
"field_project_title":{
"type":"plain_text_input",
"value":"cvgf"
}
},
"4Tf7":{
"client_project_contacts":{
"type":"multi_static_select",
"selected_options":[
{
"text":{
"type":"plain_text",
"text":"Jennifer",
"emoji":true
},
"value":"04a96f00-c84d-403c-992f-28fgh34b7ade"
}
]
}
},
"qtq0W":{
"field_project_start_date":{
"type":"datepicker",
"selected_date":"2022-01-19"
}
},
"4YOTI":{
"field_project_end_date":{
"type":"datepicker",
"selected_date":"2022-03-19"
}
},
"v09":{
"field_project_managers":{
"type":"static_select",
"selected_option":{
"text":{
"type":"plain_text",
"text":"Eric",
"emoji":true
},
"value":"b85ba51b-2346-481f-9sa8-2b9468994575"
}
}
},
"gxN9":{
"field_project_team":{
"type":"multi_static_select",
"selected_options":[
{
"text":{
"type":"plain_text",
"text":"Elliot",
"emoji":true
},
"value":"94c4b483-fbg8-4211-971d-38cf615fdc5e"
}
]
}
},
"ows":{
"setup_apps":{
"type":"checkboxes",
"selected_options":[
{
"text":{
"type":"plain_text",
"text":"Harvest",
"emoji":true
},
"value":"setup_harvest"
}
]
}
}
}
}
}
When creating a view, you can (but aren't required to) specify a "block_id" as a property for each block. When an ID isn't provided, it seems to be randomly-generated each time.
Example:
{
"type": "modal",
"callback_id": "modal-identifier",
"title": {
"type": "plain_text",
"text": "Just a modal"
},
"blocks": [
{
"type": "section",
"block_id": "section-identifier",
"text": {
"type": "mrkdwn",
"text": "*Welcome* to ~my~ Block Kit _modal_!"
},
"accessory": {
"type": "button",
"block_id": "just-a-button",
"text": {
"type": "plain_text",
"text": "Just a button",
},
"action_id": "button-identifier",
}
}
],
}
Source, and I added a second "block_id" for the button.
I have a model person that has many addresses (association/table name person_addresses)
I am trying to give the user the ability to find a person by its address.
When I try to search by address, I get: QueryingParsingException - query does not support [addresses.address]
e.g: /api/v1/search/people?q=aaron&address=scarborough
query:
[
{
"query":{
"match":{
"name":"aaron"
}
},
"sort":[
{
"id":{
"order":"desc"
}
}
],
"filter":{
"bool":{
"must":{
"nested":{
"path":"addresses",
"query":{
"terms":{
"addresses.address":"scarborough"
}
}
}
}
}
},
"aggregations":{
"addresses":{
"nested":{
"path":"addresses"
},
"aggregations":{
"nested_items":{
"terms":{
"field":"addresses.address",
"order":{
"_count":"desc"
}
}
}
}
}
}
}
]
mapping:
mapping do
indexes :first_name, type: 'multi_field', fields: {
first_name: { type: 'string', index: 'analyzed' },
na_first_name: { type: 'string', index: 'not_analyzed' }
}
indexes :middle_name, type: 'multi_field', fields: {
middle_name: { type: 'string', index: 'analyzed' },
na_middle_name: { type: 'string', index: 'not_analyzed' }
}
indexes :last_name, type: 'multi_field', fields: {
last_name: { type: 'string', index: 'analyzed' },
na_last_name: { type: 'string', index: 'not_analyzed' }
}
indexes :addresses, type: :nested do
indexes :location, type: :geo_point, index: :not_analyzed
indexes :country, type: :string, index: :not_analyzed
indexes :state, type: :string, index: :not_analyzed
indexes :address, type: :string
indexes :county, type: :string, index: :not_analyzed
indexes :city, type: :string, index: :not_analyzed
indexes :zip, type: :string, index: :not_analyzed
indexes :state_id, type: :long
indexes :county_id, type: :long
indexes :city_id, type: :long
end
end
I have this record indexed:
{
"_index": "pl_people",
"_type": "person",
"_id": "813106",
"_score": null,
"sort": [
-9223372036854775808
],
"resource": "Person",
"parameterized": "813106-aaron-mcguire",
"name": "Aaron McGuire",
"phone": "813-689-6889",
"date_of_birth": "1991-03-01",
"first_name": "Aaron",
"last_name": "McGuire",
"addresses": [
{
"id": 1,
"parameterized": "1",
"address": "123 Scarborough road",
"zip": "L5A2A9",
"city": "Ontario",
"country": "USA",
"state": "California",
"location": null,
"state_id": null,
"county_id": null,
"city_id": null
}
],
"projects": [],
}
index.json.jbuilder:
# frozen_string_literal: true
json.query do
if #term.present?
json.set!(:match, #field => #term)
else
json.set!(:match_all, {})
end
end
json.sort do
json.child! do
json.set!(:id, order: 'desc')
end
end
if [#address].any?(&:present?)
json.filter do
json.partial!('people/index/filters')
end
end
json.aggregations do
json.addresses do
json.nested do
json.set!(:path, 'addresses')
end
json.aggregations do
json.nested_items do
json.terms do
json.set!(:field, 'addresses.address')
json.set!(:order, _count: 'desc')
end
end
end
end
end
_filters.json.jbuilder:
# frozen_string_literal: true
json.bool do
json.must do
if (value = #address).present?
json.nested do
json.path('addresses')
json.query do
json.set!(:terms, 'addresses.address' => value)
end
end
end
end
end
index.rb (person search)
# frozen_string_literal: true
module Searching
module People
class Index < ::Searching::ApplicationSearching
self.valid_params = {
q: { type: :string, on_blank: :remove },
}
delegate :aggregations, to: :results
def initialize(params = {})
super(params)
end
protected
def klass
Person
end
def search
#search ||= ClientSearch.new(
index: [klass].map(&:index_name).join(','),
body: body,
size: limit,
from: offset,
)
end
def body
query_field = params[:field].present? ? params[:field] : :name
Searching::TemplateHandler.(
'people/index',
term: Searching::Util.sanitize_string(params[:q]),
field: query_field,
address: params[:address],
)
end
end
end
end
GET /pl_people
{
"pl_people":{
"aliases":{
},
"mappings":{
"person":{
"properties":{
"ac_name":{
"type":"string",
"analyzer":"autocomplete"
},
"addresses":{
"type":"nested",
"properties":{
"address":{
"type":"string"
},
"city":{
"type":"string",
"index":"not_analyzed"
},
"city_id":{
"type":"long"
},
"country":{
"type":"string",
"index":"not_analyzed"
},
"county":{
"type":"string",
"index":"not_analyzed"
},
"county_id":{
"type":"long"
},
"id":{
"type":"long"
},
"location":{
"type":"geo_point"
},
"parameterized":{
"type":"string"
},
"state":{
"type":"string",
"index":"not_analyzed"
},
"state_id":{
"type":"long"
},
"zip":{
"type":"string",
"index":"not_analyzed"
}
}
},
"author":{
"type":"string",
"index":"not_analyzed"
},
"body":{
"type":"string",
"analyzer":"remove_html",
"fields":{
"ns_body":{
"type":"string",
"analyzer":"remove_html_stopwords"
}
}
},
"charities":{
"type":"nested",
"properties":{
"email":{
"type":"string",
"index":"not_analyzed"
},
"id":{
"type":"long"
}
}
},
"community":{
"properties":{
"name":{
"type":"string",
"index":"not_analyzed"
},
"parameterized":{
"type":"string",
"index":"not_analyzed"
},
"slug":{
"type":"string",
"index":"not_analyzed"
}
}
},
"created_at":{
"type":"date",
"format":"dateOptionalTime"
},
"date_of_birth":{
"type":"date",
"format":"dateOptionalTime"
},
"description":{
"type":"string"
},
"employments":{
"type":"nested",
"properties":{
"email":{
"type":"string",
"index":"not_analyzed"
},
"employment_status":{
"type":"string",
"index":"not_analyzed"
},
"foia_contact":{
"type":"boolean"
},
"id":{
"type":"long"
},
"phone":{
"type":"string",
"index":"not_analyzed"
},
"phone_extension":{
"type":"string",
"index":"not_analyzed"
}
}
},
"first_name":{
"type":"string",
"fields":{
"na_first_name":{
"type":"string",
"index":"not_analyzed"
}
}
},
"last_name":{
"type":"string",
"fields":{
"na_last_name":{
"type":"string",
"index":"not_analyzed"
}
}
},
"market":{
"properties":{
"name":{
"type":"string",
"index":"not_analyzed"
},
"parameterized":{
"type":"string",
"index":"not_analyzed"
},
"slug":{
"type":"string",
"index":"not_analyzed"
}
}
},
"middle_name":{
"type":"string",
"fields":{
"na_middle_name":{
"type":"string",
"index":"not_analyzed"
}
}
},
"most_recent_organization":{
"properties":{
"description":{
"type":"string"
},
"id":{
"type":"long"
},
"name":{
"type":"string"
},
"parameterized":{
"type":"string"
},
"phone":{
"type":"string"
}
}
},
"name":{
"type":"string",
"fields":{
"na_name":{
"type":"string",
"index":"not_analyzed"
},
"ngram_name":{
"type":"string",
"analyzer":"my_start"
},
"ns_name":{
"type":"string",
"analyzer":"no_stopwords"
}
}
},
"organizations":{
"properties":{
"name":{
"type":"string"
},
"parameterized":{
"type":"string",
"index":"not_analyzed"
}
}
},
"package":{
"properties":{
"name":{
"type":"string",
"index":"not_analyzed"
},
"parameterized":{
"type":"string",
"index":"not_analyzed"
},
"slug":{
"type":"string",
"index":"not_analyzed"
}
}
},
"parameterized":{
"type":"string",
"index":"not_analyzed"
},
"phone":{
"type":"string"
},
"photo":{
"properties":{
"large":{
"type":"string"
},
"medium":{
"type":"string"
},
"teaser":{
"type":"string"
},
"thumb":{
"type":"string"
},
"url":{
"type":"string"
}
}
},
"projects":{
"properties":{
"id":{
"type":"long"
},
"name":{
"type":"string",
"index":"not_analyzed"
},
"parameterized":{
"type":"string",
"index":"not_analyzed"
},
"slug":{
"type":"string",
"index":"not_analyzed"
}
}
},
"public_offices":{
"type":"nested",
"properties":{
"email":{
"type":"string",
"index":"not_analyzed"
},
"employment_status":{
"type":"string",
"index":"not_analyzed"
},
"id":{
"type":"long"
}
}
},
"published":{
"type":"string",
"index":"not_analyzed"
},
"region":{
"properties":{
"name":{
"type":"string",
"index":"not_analyzed"
},
"parameterized":{
"type":"string",
"index":"not_analyzed"
},
"slug":{
"type":"string",
"index":"not_analyzed"
}
}
},
"resource":{
"type":"string"
},
"short_description":{
"type":"string"
},
"show_path":{
"type":"string"
},
"time":{
"type":"date",
"format":"dateOptionalTime"
},
"updated_at":{
"type":"date",
"format":"dateOptionalTime"
}
}
}
},
"settings":{
"index":{
"creation_date":"1581684793139",
"analysis":{
"filter":{
"english_stop":{
"type":"stop",
"stopwords":[
"a",
"an",
"and",
"are",
"as",
"at",
"be",
"but",
"by",
"for",
"if",
"in",
"into",
"is",
"it",
"no",
"not",
"of",
"on",
"or",
"such",
"that",
"the",
"their",
"then",
"there",
"these",
"they",
"this",
"to",
"was",
"with"
]
},
"my_edge":{
"min_gram":"2",
"side":"front",
"type":"edgeNGram",
"max_gram":"18"
}
},
"analyzer":{
"no_stopwords":{
"type":"stop",
"stopwords":"_english_"
},
"comma":{
"pattern":",",
"type":"pattern"
},
"default":{
"filter":[
"standard",
"lowercase",
"english_stop",
"word_delimiter"
],
"tokenizer":"standard"
},
"remove_html_stopwords":{
"filter":"stop",
"char_filter":"html_strip",
"type":"custom",
"stopwords":"_english_",
"tokenizer":"lowercase"
},
"autocomplete":{
"filter":[
"lowercase",
"apostrophe"
],
"tokenizer":"keyword"
},
"my_start":{
"filter":[
"asciifolding",
"lowercase",
"my_edge"
],
"tokenizer":"whitespace"
},
"remove_html":{
"filter":"lowercase",
"char_filter":"html_strip",
"type":"custom",
"tokenizer":"standard"
}
}
},
"number_of_shards":"5",
"number_of_replicas":"1",
"version":{
"created":"1070699"
},
"uuid":"LZrnPjxiTwyNf-Ggo3bXtw"
}
},
"warmers":{
}
}
}
Any naming conventions I am not following?
I tried changing person_address for address on filters.json and index.json, but still didnt have any success.
So i reinstall es 1.7 and made some try, simplified your data.
the error was in the "terms" in the filter, you have to use a term / match instead. If you want to add multiple condition it seems you need to build boolean query with a term on each.
Moreover i cant understand why you use a post_filter here (filter at top level = post_filter in es > 2.X), can you explain it?
This is what i done using HEAD if you want reproduce (i simplify the mappings, keeping only relevant fields).
hope it s help.
http://localhost:9200/pl_people/ (POST)
{
"mappings":{
"person":{
"properties":{
"ac_name":{
"type":"string"
},
"addresses":{
"type":"nested",
"properties":{
"address":{
"type":"string"
},
"city":{
"type":"string",
"index":"not_analyzed"
},
"city_id":{
"type":"long"
},
"country":{
"type":"string",
"index":"not_analyzed"
},
"county":{
"type":"string",
"index":"not_analyzed"
},
"county_id":{
"type":"long"
},
"id":{
"type":"long"
},
"location":{
"type":"geo_point"
},
"parameterized":{
"type":"string"
},
"state":{
"type":"string",
"index":"not_analyzed"
},
"state_id":{
"type":"long"
},
"zip":{
"type":"string",
"index":"not_analyzed"
}
}
},
"date_of_birth":{
"type":"date",
"format":"dateOptionalTime"
},
"first_name":{
"type":"string",
"fields":{
"na_first_name":{
"type":"string",
"index":"not_analyzed"
}
}
},
"last_name":{
"type":"string",
"fields":{
"na_last_name":{
"type":"string",
"index":"not_analyzed"
}
}
},
"name":{
"type":"string",
"fields":{
"na_name":{
"type":"string",
"index":"not_analyzed"
},
"ngram_name":{
"type":"string"
},
"ns_name":{
"type":"string"
}
}
},
"parameterized":{
"type":"string",
"index":"not_analyzed"
},
"phone":{
"type":"string"
},
"resource":{
"type":"string"
}
}
}
}
}
http://localhost:9200/pl_people/person/813106 (POST)
{
"ac_name": "Aaron McGuire",
"resource": "Person",
"parameterized": "813106-aaron-mcguire",
"name": "Aaron McGuire",
"phone": "813-689-6889",
"date_of_birth": "1991-03-01",
"first_name": "Aaron",
"last_name": "McGuire",
"addresses": [
{
"id": 1,
"parameterized": "1",
"address": "123 Scarborough road",
"zip": "L5A2A9",
"city": "Ontario",
"country": "USA",
"state": "California"
}
]
}
http://localhost:9200/pl_people/person/_search/ (post)
{
"query": {
"match": {
"name": "aaron"
}
},
"sort": [
{
"id": {
"order": "desc"
}
}
],
"filter": {
"bool": {
"must": {
"nested": {
"path": "addresses",
"query": {
"term": {
"addresses.address": "scarborough"
}
}
}
}
}
},
"aggregations": {
"addresses": {
"nested": {
"path": "addresses"
},
"aggregations": {
"nested_items": {
"terms": {
"field": "addresses.address",
"order": {
"_count": "desc"
}
}
}
}
}
}
}
I can't seem to figure out why swagger validation is failing
What is strange is that if I add more than one path the validation only complains about the last one. Then if I remove the last one it starts complaining about the one above it.
When working in the swagger editor then it all seems to validate.
The swagger document is as follows:
{
"swagger":"2.0",
"info":{
"version":"0.0.1",
"title":"Bla API"
},
"schemes":[
"https"
],
"produces":[
"application/json"
],
"host":"rest.bla.com",
"basePath":"/api/v2/fleet",
"paths":{
"/{organisation_id}/access_groups":{
"get":{
"tags":[
"Access Group"
],
"summary":"Get access groups\n",
"description":"Gets a list of 'access_group' objects based on the provided search criteria\n",
"parameters":[
{
"in":"path",
"name":"organisation_id",
"required":"true",
"type":"string"
},
{
"name":"term",
"in":"query",
"required":"false",
"type":"string"
},
{
"name":"take",
"in":"query",
"required":"true",
"type":"integer",
"format":"int32"
},
{
"name":"skip",
"in":"query",
"type":"integer",
"format":"int32",
"required":"true"
},
{
"name":"order",
"in":"query",
"type":"string"
}
],
"responses":{
"403":{
"description":"Permission Denied",
"schema":{
"$ref":"#/definitions/error"
}
},
"200":{
"description":"OK",
"schema":{
"type":"object",
"properties":{
"data":{
"type":"array",
"items":{
"$ref":"#/definitions/access-group-response"
}
},
"pagination":{
"$ref":"#/definitions/pagination"
}
}
}
}
}
}
}
},
"definitions":{
"access-group":{
"description":"an object which provides the ability to grant access to specific assets\n",
"properties":{
"name":{
"type":"string"
}
}
},
"access-group-response":{
"properties":{
"data":{
"$ref":"#/definitions/access-group"
},
"links":{
"type":"array",
"items":{
"$ref":"#/definitions/link"
}
}
}
},
"error":{
"type":"array",
"items":{
"type":"object",
"properties":{
"type":{
"type":"string"
},
"code":{
"type":"string"
},
"message":{
"type":"string"
},
"key":{
"type":"string"
}
}
}
},
"link":{
"properties":{
"href":{
"type":"string"
},
"rel":{
"type":"string"
}
}
},
"pagination":{
"properties":{
"page":{
"type":"number",
"format":"int32"
},
"total":{
"type":"number",
"format":"int32"
}
}
}
}
}
while the validation error is as follows:
{
"schemaValidationMessages":[
{
"level":"error",
"domain":"validation",
"keyword":"oneOf",
"message":"instance failed to match exactly one schema (matched 0 out of 2)",
"schema":{
"loadingURI":"http://swagger.io/v2/schema.json#",
"pointer":"/definitions/parametersList/items"
},
"instance":{
"pointer":"/paths/~1{organisation_id}~1access_groups/get/parameters/0"
}
},
{
"level":"error",
"domain":"validation",
"keyword":"oneOf",
"message":"instance failed to match exactly one schema (matched 0 out of 2)",
"schema":{
"loadingURI":"http://swagger.io/v2/schema.json#",
"pointer":"/definitions/parametersList/items"
},
"instance":{
"pointer":"/paths/~1{organisation_id}~1access_groups/get/parameters/1"
}
},
{
"level":"error",
"domain":"validation",
"keyword":"oneOf",
"message":"instance failed to match exactly one schema (matched 0 out of 2)",
"schema":{
"loadingURI":"http://swagger.io/v2/schema.json#",
"pointer":"/definitions/parametersList/items"
},
"instance":{
"pointer":"/paths/~1{organisation_id}~1access_groups/get/parameters/2"
}
},
{
"level":"error",
"domain":"validation",
"keyword":"oneOf",
"message":"instance failed to match exactly one schema (matched 0 out of 2)",
"schema":{
"loadingURI":"http://swagger.io/v2/schema.json#",
"pointer":"/definitions/parametersList/items"
},
"instance":{
"pointer":"/paths/~1{organisation_id}~1access_groups/get/parameters/3"
}
}
]
}
The required property of the parameters object should be a boolean type, not a string.
If you replace all "required":"true"s with "required":true and "required":"false"s with "required":false your example validates ok.
Since ugprading to Swagger 1.5.3-M1 from 1.5.3 I noticed our swagger.json file is different (and wrong)
Before a sample get request would look like this.
"paths":{
"/stores":{
"get":{
"tags":[
"stores"
],
"summary":"Retrieve a list of stores",
"description":"",
"operationId":"getStores",
"produces":[
"application/json"
],
"parameters":[
{
"name":"api_key",
"in":"query",
"description":"API consumer key",
"required":false,
"type":"string"
},
{
"name":"onlyConnectedStores",
"in":"query",
"description":"Only select connected stores",
"required":false,
"type":"string"
},
{
"name":"offset",
"in":"query",
"description":"Number of records to offset before returning first record",
"required":false,
"type":"string",
"default":"0"
},
{
"name":"limit",
"in":"query",
"description":"Number of records to return",
"required":false,
"type":"string",
"default":"10"
}
],
Now it looks like this
"paths":{
"/stores":{
"get":{
"tags":[
"stores"
],
"summary":"Retrieve a list of stores",
"description":"",
"operationId":"getStores",
"produces":[
"application/json"
],
"parameters":[
{
"in":"body",
"name":"body",
"required":false,
"schema":{
"$ref":"#/definitions/AsynchronousResponse"
}
},
{
"name":"api_key",
"in":"query",
"description":"API consumer key",
"required":true,
"type":"string"
},
{
"name":"onlyConnectedStores",
"in":"query",
"description":"Only select connected stores",
"required":false,
"type":"string",
"default":"false"
},
{
"name":"offset",
"in":"query",
"description":"Number of records to offset before returning first record",
"required":false,
"type":"string",
"default":"0"
},
{
"name":"limit",
"in":"query",
"description":"Number of records to return",
"required":false,
"type":"string",
"default":"10"
}
],
Is because of this it appears to be showing body as a parameter for any of our GET requests when there is in fact no "body" param.
Any ida why this extra "body" param would be showing up on the lattest swagger release?
Yup, this is due to some behavioral change. I assume the method in question has a parameter called AsynchronousResponse. It would help if you can open an issue on the project with the method signature, so we may be able to hide the parameter by default.
In the mean time, you can hide it by adding on that method parameter #ApiParam(hidden=true).
I call the code like so:
var studyDataService = new breeze.DataService({ serviceName: _config.RemoteStudyDataServiceName, hasServerMetadata: false });
var mgr = new breeze.EntityManager({ dataService: studyDataService });
mgr.metadataStore.importMetadata(mmg.StudyMetadata);
And the schema comes from the server-side /Metadata endpoint. That didn't work right off the bat but I then used metadataStore.exportMetadata(), saved that string, and put that in my script. It looks like this:
mmg.StudyMetadata = {
"schema":
{
"namespace": "CodeFirstNamespace",
"alias": "Self",
"d4p1:UseStrongSpatialTypes": "false",
"xmlns:d4p1": "http://schemas.microsoft.com/ado/2009/02/edm/annotation",
"xmlns": "http://schemas.microsoft.com/ado/2009/11/edm",
"cSpaceOSpaceMapping": {
"CodeFirstNamespace.Study": "MMG.Legacy.StudySiteComm.Core.Entities.Study",
"CodeFirstNamespace.StudySite": "MMG.Legacy.StudySiteComm.Core.Entities.StudySite",
"CodeFirstNamespace.SiteContact": "MMG.Legacy.StudySiteComm.Core.Entities.SiteContact"
},
"entityType": [{ "name": "Study", "key": { "propertyRef": { "name": "StudyID" } }, "property": [{ "name": "StudyID", "type": "Edm.Int32", "nullable": "false", "d4p1:StoreGeneratedPattern": "Identity" }, { "name": "StudyName", "type": "Edm.String", "fixedLength": "false", "maxLength": "100", "unicode": "true", "nullable": "false" }, { "name": "ClientName", "type": "Edm.String", "fixedLength": "false", "maxLength": "100", "unicode": "true", "nullable": "false" }], "navigationProperty": { "name": "StudySites", "relationship": "Self.StudySite_Study", "fromRole": "StudySite_Study_Target", "toRole": "StudySite_Study_Source" } },
{ "name": "StudySite", "key": { "propertyRef": { "name": "SiteID" } }, "property": [{ "name": "StudyID", "type": "Edm.Int32", "nullable": "true" }, { "name": "SiteID", "type": "Edm.Int32", "nullable": "false", "d4p1:StoreGeneratedPattern": "Identity" }, { "name": "ClientID", "type": "Edm.String", "fixedLength": "false", "maxLength": "12", "unicode": "true", "nullable": "false" }], "navigationProperty": [{ "name": "Contacts", "relationship": "Self.SiteContact_StudySite", "fromRole": "SiteContact_StudySite_Target", "toRole": "SiteContact_StudySite_Source" }, { "name": "Study", "relationship": "Self.StudySite_Study", "fromRole": "StudySite_Study_Source", "toRole": "StudySite_Study_Target" }] },
{ "name": "SiteContact", "key": { "propertyRef": { "name": "ContactID" } }, "property": [{ "name": "ContactID", "type": "Edm.Int32", "nullable": "false", "d4p1:StoreGeneratedPattern": "Identity" }, { "name": "StudySiteID", "type": "Edm.Int32", "nullable": "true" }, { "name": "FirstName", "type": "Edm.String", "fixedLength": "false", "maxLength": "50", "unicode": "true", "nullable": "true" }, { "name": "LastName", "type": "Edm.String", "fixedLength": "false", "maxLength": "50", "unicode": "true", "nullable": "true" }, { "name": "EmailAddress", "type": "Edm.String", "fixedLength": "false", "maxLength": "150", "unicode": "true", "nullable": "true" }, { "name": "ContactType", "type": "Edm.Self.ContactTypeEnum", "nullable": "false" }], "navigationProperty": { "name": "StudySite", "relationship": "Self.SiteContact_StudySite", "fromRole": "SiteContact_StudySite_Source", "toRole": "SiteContact_StudySite_Target" } }],
"enumType": { "name": "ContactTypeEnum", "isFlags": "false", "underlyingType": "Int32", "member": [{ "name": "PrimaryInvestigator", "value": "0" }, { "name": "StudyCoordinator", "value": "1" }, { "name": "ShippingContact", "value": "2" }, { "name": "CRA", "value": "3" }, { "name": "RecruitmentSpecialist", "value": "4" }, { "name": "Other", "value": "5" }] },
"association": [{ "name": "SiteContact_StudySite", "end": [{ "role": "SiteContact_StudySite_Source", "type": "Edm.Self.SiteContact", "multiplicity": "*" }, { "role": "SiteContact_StudySite_Target", "type": "Edm.Self.StudySite", "multiplicity": "0..1" }], "referentialConstraint": { "principal": { "role": "SiteContact_StudySite_Target", "propertyRef": { "name": "SiteID" } }, "dependent": { "role": "SiteContact_StudySite_Source", "propertyRef": { "name": "StudySiteID" } } } }, { "name": "StudySite_Study", "end": [{ "role": "StudySite_Study_Source", "type": "Edm.Self.StudySite", "multiplicity": "*" }, { "role": "StudySite_Study_Target", "type": "Edm.Self.Study", "multiplicity": "0..1" }], "referentialConstraint": { "principal": { "role": "StudySite_Study_Target", "propertyRef": { "name": "StudyID" } }, "dependent": { "role": "StudySite_Study_Source", "propertyRef": { "name": "StudyID" } } } }],
"entityContainer": { "name": "CodeFirstContainer", "entitySet": [{ "name": "Studies", "entityType": "Self.Study" }, { "name": "StudySites", "entityType": "Self.StudySite" }, { "name": "SiteContacts", "entityType": "Self.SiteContact" }], "associationSet": [{ "name": "SiteContact_StudySite", "association": "Self.SiteContact_StudySite", "end": [{ "role": "SiteContact_StudySite_Source", "entitySet": "SiteContacts" }, { "role": "SiteContact_StudySite_Target", "entitySet": "StudySites" }] }, { "name": "StudySite_Study", "association": "Self.StudySite_Study", "end": [{ "role": "StudySite_Study_Source", "entitySet": "StudySites" }, { "role": "StudySite_Study_Target", "entitySet": "Studies" }] }] }
}
}
Turns out that importMetadata expects an array for cSpaceOSpaceMapping property and while I tried that at first, I then realized I didn't have properly formatted json.
So to refresh the metadata script for a fresh import:
1. copy and paste from /metadata
2. Remove first double quote and the one at the end.
3. Then replace all \" with " in the entire string.
4. for cSpaceOSpaceMapping object, replace \" with \"
Comes from metadata like this:
"{\"schema\":{\"namespace\":\"CodeFirstNamespace\",\"alias\":\"Self\",\"d4p1:UseStrongSpatialTypes\":\"false\",\"xmlns:d4p1\":\"http://schemas.microsoft.com/ado/2009/02/edm/annotation\",\"xmlns\":\"http://schemas.microsoft.com/ado/2009/11/edm\",\"cSpaceOSpaceMapping\":\"[[\\\"CodeFirstNamespace.Study\\\",\\\"MMG.Legacy.StudySiteComm.Core.Entities.Study\\\"],[\\\"CodeFirstNamespace.StudySite\\\",\\\"MMG.Legacy.StudySiteComm.Core.Entities.StudySite\\\"],[\\\"CodeFirstNamespace.SiteContact\\\",\\\"MMG.Legacy.StudySiteComm.Core.Entities.SiteContact\\\"]]\",\"entityType\":[{\"name\":\"Study\",\"key\":{\"propertyRef\":{\"name\":\"StudyID\"}},\"property\":[{\"name\":\"StudyID\",\"type\":\"Edm.Int32\",\"nullable\":\"false\",\"d4p1:StoreGeneratedPattern\":\"Identity\"},{\"name\":\"StudyName\",\"type\":\"Edm.String\",\"fixedLength\":\"false\",\"maxLength\":\"100\",\"unicode\":\"true\",\"nullable\":\"false\"},{\"name\":\"ClientName\",\"type\":\"Edm.String\",\"fixedLength\":\"false\",\"maxLength\":\"100\",\"unicode\":\"true\",\"nullable\":\"false\"}],\"navigationProperty\":{\"name\":\"StudySites\",\"relationship\":\"Self.StudySite_Study\",\"fromRole\":\"StudySite_Study_Target\",\"toRole\":\"StudySite_Study_Source\"}},{\"name\":\"StudySite\",\"key\":{\"propertyRef\":{\"name\":\"SiteID\"}},\"property\":[{\"name\":\"StudyID\",\"type\":\"Edm.Int32\",\"nullable\":\"true\"},{\"name\":\"SiteID\",\"type\":\"Edm.Int32\",\"nullable\":\"false\",\"d4p1:StoreGeneratedPattern\":\"Identity\"},{\"name\":\"ClientID\",\"type\":\"Edm.String\",\"fixedLength\":\"false\",\"maxLength\":\"12\",\"unicode\":\"true\",\"nullable\":\"false\"}],\"navigationProperty\":[{\"name\":\"Contacts\",\"relationship\":\"Self.SiteContact_StudySite\",\"fromRole\":\"SiteContact_StudySite_Target\",\"toRole\":\"SiteContact_StudySite_Source\"},{\"name\":\"Study\",\"relationship\":\"Self.StudySite_Study\",\"fromRole\":\"StudySite_Study_Source\",\"toRole\":\"StudySite_Study_Target\"}]},{\"name\":\"SiteContact\",\"key\":{\"propertyRef\":{\"name\":\"ContactID\"}},\"property\":[{\"name\":\"ContactID\",\"type\":\"Edm.Int32\",\"nullable\":\"false\",\"d4p1:StoreGeneratedPattern\":\"Identity\"},{\"name\":\"StudySiteID\",\"type\":\"Edm.Int32\",\"nullable\":\"true\"},{\"name\":\"FirstName\",\"type\":\"Edm.String\",\"fixedLength\":\"false\",\"maxLength\":\"50\",\"unicode\":\"true\",\"nullable\":\"true\"},{\"name\":\"LastName\",\"type\":\"Edm.String\",\"fixedLength\":\"false\",\"maxLength\":\"50\",\"unicode\":\"true\",\"nullable\":\"true\"},{\"name\":\"EmailAddress\",\"type\":\"Edm.String\",\"fixedLength\":\"false\",\"maxLength\":\"150\",\"unicode\":\"true\",\"nullable\":\"true\"},{\"name\":\"ContactType\",\"type\":\"Edm.Self.ContactTypeEnum\",\"nullable\":\"false\"}],\"navigationProperty\":{\"name\":\"StudySite\",\"relationship\":\"Self.SiteContact_StudySite\",\"fromRole\":\"SiteContact_StudySite_Source\",\"toRole\":\"SiteContact_StudySite_Target\"}}],\"enumType\":{\"name\":\"ContactTypeEnum\",\"isFlags\":\"false\",\"underlyingType\":\"Int32\",\"member\":[{\"name\":\"PrimaryInvestigator\",\"value\":\"0\"},{\"name\":\"StudyCoordinator\",\"value\":\"1\"},{\"name\":\"ShippingContact\",\"value\":\"2\"},{\"name\":\"CRA\",\"value\":\"3\"},{\"name\":\"RecruitmentSpecialist\",\"value\":\"4\"},{\"name\":\"Other\",\"value\":\"5\"}]},\"association\":[{\"name\":\"SiteContact_StudySite\",\"end\":[{\"role\":\"SiteContact_StudySite_Source\",\"type\":\"Edm.Self.SiteContact\",\"multiplicity\":\"*\"},{\"role\":\"SiteContact_StudySite_Target\",\"type\":\"Edm.Self.StudySite\",\"multiplicity\":\"0..1\"}],\"referentialConstraint\":{\"principal\":{\"role\":\"SiteContact_StudySite_Target\",\"propertyRef\":{\"name\":\"SiteID\"}},\"dependent\":{\"role\":\"SiteContact_StudySite_Source\",\"propertyRef\":{\"name\":\"StudySiteID\"}}}},{\"name\":\"StudySite_Study\",\"end\":[{\"role\":\"StudySite_Study_Source\",\"type\":\"Edm.Self.StudySite\",\"multiplicity\":\"*\"},{\"role\":\"StudySite_Study_Target\",\"type\":\"Edm.Self.Study\",\"multiplicity\":\"0..1\"}],\"referentialConstraint\":{\"principal\":{\"role\":\"StudySite_Study_Target\",\"propertyRef\":{\"name\":\"StudyID\"}},\"dependent\":{\"role\":\"StudySite_Study_Source\",\"propertyRef\":{\"name\":\"StudyID\"}}}}],\"entityContainer\":{\"name\":\"CodeFirstContainer\",\"entitySet\":[{\"name\":\"Studies\",\"entityType\":\"Self.Study\"},{\"name\":\"StudySites\",\"entityType\":\"Self.StudySite\"},{\"name\":\"SiteContacts\",\"entityType\":\"Self.SiteContact\"}],\"associationSet\":[{\"name\":\"SiteContact_StudySite\",\"association\":\"Self.SiteContact_StudySite\",\"end\":[{\"role\":\"SiteContact_StudySite_Source\",\"entitySet\":\"SiteContacts\"},{\"role\":\"SiteContact_StudySite_Target\",\"entitySet\":\"StudySites\"}]},{\"name\":\"StudySite_Study\",\"association\":\"Self.StudySite_Study\",\"end\":[{\"role\":\"StudySite_Study_Source\",\"entitySet\":\"StudySites\"},{\"role\":\"StudySite_Study_Target\",\"entitySet\":\"Studies\"}]}]}}}"
and should end up like this:
{ "schema": { "namespace": "CodeFirstNamespace", "alias": "Self", "d4p1:UseStrongSpatialTypes": "false", "xmlns:d4p1": "http://schemas.microsoft.com/ado/2009/02/edm/annotation", "xmlns": "http://schemas.microsoft.com/ado/2009/11/edm", "cSpaceOSpaceMapping": "[[\"CodeFirstNamespace.Study\",\"MMG.Legacy.StudySiteComm.Core.Entities.Study\"],[\"CodeFirstNamespace.StudySite\",\"MMG.Legacy.StudySiteComm.Core.Entities.StudySite\"],[\"CodeFirstNamespace.SiteContact\",\"MMG.Legacy.StudySiteComm.Core.Entities.SiteContact\"]]", "entityType": [{ "name": "Study", "key": { "propertyRef": { "name": "StudyID" } }, "property": [{ "name": "StudyID", "type": "Edm.Int32", "nullable": "false", "d4p1:StoreGeneratedPattern": "Identity" }, { "name": "StudyName", "type": "Edm.String", "fixedLength": "false", "maxLength": "100", "unicode": "true", "nullable": "false" }, { "name": "ClientName", "type": "Edm.String", "fixedLength": "false", "maxLength": "100", "unicode": "true", "nullable": "false" }], "navigationProperty": { "name": "StudySites", "relationship": "Self.StudySite_Study", "fromRole": "StudySite_Study_Target", "toRole": "StudySite_Study_Source" } }, { "name": "StudySite", "key": { "propertyRef": { "name": "SiteID" } }, "property": [{ "name": "StudyID", "type": "Edm.Int32", "nullable": "true" }, { "name": "SiteID", "type": "Edm.Int32", "nullable": "false", "d4p1:StoreGeneratedPattern": "Identity" }, { "name": "ClientID", "type": "Edm.String", "fixedLength": "false", "maxLength": "12", "unicode": "true", "nullable": "false" }], "navigationProperty": [{ "name": "Contacts", "relationship": "Self.SiteContact_StudySite", "fromRole": "SiteContact_StudySite_Target", "toRole": "SiteContact_StudySite_Source" }, { "name": "Study", "relationship": "Self.StudySite_Study", "fromRole": "StudySite_Study_Source", "toRole": "StudySite_Study_Target" }] }, { "name": "SiteContact", "key": { "propertyRef": { "name": "ContactID" } }, "property": [{ "name": "ContactID", "type": "Edm.Int32", "nullable": "false", "d4p1:StoreGeneratedPattern": "Identity" }, { "name": "StudySiteID", "type": "Edm.Int32", "nullable": "true" }, { "name": "FirstName", "type": "Edm.String", "fixedLength": "false", "maxLength": "50", "unicode": "true", "nullable": "true" }, { "name": "LastName", "type": "Edm.String", "fixedLength": "false", "maxLength": "50", "unicode": "true", "nullable": "true" }, { "name": "EmailAddress", "type": "Edm.String", "fixedLength": "false", "maxLength": "150", "unicode": "true", "nullable": "true" }, { "name": "ContactType", "type": "Edm.Self.ContactTypeEnum", "nullable": "false" }], "navigationProperty": { "name": "StudySite", "relationship": "Self.SiteContact_StudySite", "fromRole": "SiteContact_StudySite_Source", "toRole": "SiteContact_StudySite_Target" } }], "enumType": { "name": "ContactTypeEnum", "isFlags": "false", "underlyingType": "Int32", "member": [{ "name": "PrimaryInvestigator", "value": "0" }, { "name": "StudyCoordinator", "value": "1" }, { "name": "ShippingContact", "value": "2" }, { "name": "CRA", "value": "3" }, { "name": "RecruitmentSpecialist", "value": "4" }, { "name": "Other", "value": "5" }] }, "association": [{ "name": "SiteContact_StudySite", "end": [{ "role": "SiteContact_StudySite_Source", "type": "Edm.Self.SiteContact", "multiplicity": "*" }, { "role": "SiteContact_StudySite_Target", "type": "Edm.Self.StudySite", "multiplicity": "0..1" }], "referentialConstraint": { "principal": { "role": "SiteContact_StudySite_Target", "propertyRef": { "name": "SiteID" } }, "dependent": { "role": "SiteContact_StudySite_Source", "propertyRef": { "name": "StudySiteID" } } } }, { "name": "StudySite_Study", "end": [{ "role": "StudySite_Study_Source", "type": "Edm.Self.StudySite", "multiplicity": "*" }, { "role": "StudySite_Study_Target", "type": "Edm.Self.Study", "multiplicity": "0..1" }], "referentialConstraint": { "principal": { "role": "StudySite_Study_Target", "propertyRef": { "name": "StudyID" } }, "dependent": { "role": "StudySite_Study_Source", "propertyRef": { "name": "StudyID" } } } }], "entityContainer": { "name": "CodeFirstContainer", "entitySet": [{ "name": "Studies", "entityType": "Self.Study" }, { "name": "StudySites", "entityType": "Self.StudySite" }, { "name": "SiteContacts", "entityType": "Self.SiteContact" }], "associationSet": [{ "name": "SiteContact_StudySite", "association": "Self.SiteContact_StudySite", "end": [{ "role": "SiteContact_StudySite_Source", "entitySet": "SiteContacts" }, { "role": "SiteContact_StudySite_Target", "entitySet": "StudySites" }] }, { "name": "StudySite_Study", "association": "Self.StudySite_Study", "end": [{ "role": "StudySite_Study_Source", "entitySet": "StudySites" }, { "role": "StudySite_Study_Target", "entitySet": "Studies" }] }] } } }