diff --git a/config/defaults.json b/config/defaults.json index fab7daff8c3..d4490898cba 100644 --- a/config/defaults.json +++ b/config/defaults.json @@ -9,11 +9,6 @@ "server": "http://morpho-codegen.azurewebsites.net/server/codegen/?name={language}", "client": "http://morpho-codegen.azurewebsites.net/client/codegen/?name={language}" }, - "analytics": { - "google": { - "id": "UA-51231036-1" - } - }, "disableCodeGen": false, "examplesFolder": "spec-files/", "editorOptions": { diff --git a/scripts/analytics/google.js b/scripts/analytics/google.js deleted file mode 100644 index b1379bf4e87..00000000000 --- a/scripts/analytics/google.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; - -(function(i,s,o,g,r,a,m) {i['GoogleAnalyticsObject']=r;i[r]=i[r]||function() { - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) -})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); diff --git a/scripts/components.js b/scripts/components.js index 670cd7bdb91..be31a8bf1e9 100644 --- a/scripts/components.js +++ b/scripts/components.js @@ -69,7 +69,7 @@ require('scripts/plugins/jquery.scroll-into-view.js'); // Misc require('scripts/ace/snippets/swagger.snippet.js'); -require('scripts/analytics/google.js'); +//require('scripts/analytics/google.js'); // Ace Editor window.ace = require('brace'); diff --git a/scripts/controllers/header.js b/scripts/controllers/header.js index a40b195027e..1eea73835a2 100644 --- a/scripts/controllers/header.js +++ b/scripts/controllers/header.js @@ -194,9 +194,12 @@ SwaggerEditor.controller('HeaderCtrl', function HeaderCtrl($scope, $uibModal, var assign = function(yaml, json) { // swagger and version should be a string to comfort with the schema - if (json.info.version) { + if (json.info&&json.info.version) { json.info.version = String(json.info.version); } + if (json.api.version&&json.api.version.current) { + json.api.version.current = String(json.api.version.current); + } if (json.swagger) { if (json.swagger === 2) { json.swagger = '2.0'; diff --git a/spec-files/guide.yaml b/spec-files/guide.yaml index 14df8627aef..b8c59622add 100644 --- a/spec-files/guide.yaml +++ b/spec-files/guide.yaml @@ -1,49 +1,105 @@ -# Example YAML to get you started quickly. -# Be aware that YAML has indentation based scoping. -# Code completion support is available so start typing for available options. -swagger: '2.0' +# This YAML file lays out the full definition of what a model-first YAML file can contain. -# This is your document metadata -info: - version: "0.0.0" - title: - -# Describe your paths here -paths: - # This is a path endpoint. Change it. - /persons: - # This is a HTTP operation - get: - # Describe this verb here. Note: you can use markdown - description: | - Gets `Person` objects. - Optional query param of **size** determines - size of returned array - # This is array of GET operation parameters: - parameters: - # An example parameter that is in query and is required - - - name: size - in: query - description: Size of array - required: true - type: number - format: double - # Expected responses for this operation: - responses: - # Response code - 200: - description: Successful response - # A schema describing your response object. - # Use JSON Schema format - schema: - title: ArrayOfPersons - type: array - items: - title: Person - type: object - properties: - name: - type: string - single: - type: boolean \ No newline at end of file +# The api section defines metadata about the service - name, contact info, etc. +api: # Required + name: REST API Name # Required + version: # Optional + current: 1.0.0 + description: This REST API does something amazing! # Optional + namespace: "REST.API.Namespace" # Optional, default generated from the name + host: services.example.org # Optional + basePath: /base/path # Optional. Or rootUrl to replace host and basePath + termsOfService: http://example.org/tos # Optional + contact: # Optional + name: API Support + url: http://www.example.io/support + email: support@example.io + license: # Optional + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + auth: Basic # Optional + conformance: minimal # Optional + supportsFilterFunctions: [contains, endswith, startswith, length, indexof, substring, tolower, toupper, trim, concat, year, month, day, hour, minute, second, round, floor, ceiling, cast, isof] # Optional + +root: # Required. + # Collection + - name: EntitySet # Required. + type: EntityType[] # Required. + allows: [read, create, update, delete] # Optional + searchable: true # Optional + insertable: true # Optional + deletable: false # Optional + concurrencyProperties: concurrency # Optional. Data modification requires the use of ETags. + disallowNavigation: navigationProperty # Optional + disallowInsert: [navigationProperty] # Optional + # Singleton + - name: Singleton # Required. + type: EntityType # Required. + # Operation + - name: QueryFunction # Required. + params: # Optional + - name: userId # Required. + type: int32 # Optional. Default string. + returns: EntityType[] # Required. + - name: ExecuteAction + params: # Optional + - name: parameterName # Required. + type: int32 # Optional. Default string. + +# The types section defines types used the service. +types: # Required. + # Enumeration type + - name: EnumType # Required. + members: # Required. + - name: none + value: 0 # Optional + - name: enum1 + value: 1 # Optional + - name: enum2 + value: 2 # Optional + # Complex type + - name: BaseType + requiredProperties: # Optional + - name: price # Required. + type: decimal # Optional + isoCurrency: USD # Optional. The currency for this monetary amount as an ISO 4217 currency code + immutable: true # Optional. A value for this non-key property can be provided on insert and remains unchanged on update + # Entity type + - name: EntityType # Required. + key: # Required. + - name: id # Optional + baseType: BaseType # Optional + dynamic: true # Optional. dynamic type allows clients to add properties dynamically to instances of the type by specifying uniquely named values in the payload used to insert or update an instance of the type. + requiredProperties: # Optional + - name: name # Required. + type: string # Optional + - name: enumProperty # Required. + type: EnumType # Optional + - name: location # Required. + type: geographypoint # Optional + optionalProperties: # Optional + - name: concurrency # Required. + type: int64 # Optional + computed: true # Optional。 A value for this property is generated on both insert and update + - name: navigationProperty # Required. + type: AnotherEntityType # Optional + containsTarget: true # Optional. Containment navigation properties define an implicit entity set for each instance of its declaring entity type. This implicit entity set is identified by the read URL of the navigation property for that entity. + operations: # Optional + - name: BoundOperation # Required. + params: # Optional + - name: parameterName # Required. + type: string # Optional + returns: EntityType # Optional + - name: AnotherEntityType # Required. + key: Id # Required. + hasStream: false # Optional. A value of true specifies that the entity type is a media entity. + requiredProperties: # Optional + - name: name # Required. + type: string # Optional + computed: false # Optional + operations: # Optional + - name: BoundToContainedType # Required. + params: # Optional + - name: parameterName # Required. + type: string # Optional + returns: AnotherEntityType # Optional diff --git a/spec-files/simpleTrippin.yaml b/spec-files/simpleTrippin.yaml index 6820dda348d..88af92bf495 100644 --- a/spec-files/simpleTrippin.yaml +++ b/spec-files/simpleTrippin.yaml @@ -4,48 +4,64 @@ api: version: current: 1.0.0 description: "TripPin is a fictional reference service demonstrating the capabilities of OData v4." + namespace: "Microsoft.OData.SampleService.Models.TripPin" + host: services.odata.org + basePath: /V4/TripPinServiceRW + termsOfService: http://swagger.io/terms/ + contact: + name: API Support + url: http://www.swagger.io/support + email: support@swagger.io + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html auth: none conformance: minimal supportsFilterFunctions: [contains, endswith, startswith, length, indexof, substring, tolower, toupper, trim, concat, year, month, day, hour, minute, second, round, floor, ceiling, cast, isof] - host: services.odata.org - basePath: /V4/(S(cnbm44wtbc1v5bgrlek5lpcc))/TripPinServiceRW root: - - name: Photos + - name: photos type: photo[] - allows : [read, create, delete] searchable: true insertable: true - - name: People + - name: people type: person[] - allows : [update] searchable: true insertable: true concurrencyProperties: concurrency disallowNavigation: friends disallowInsert: [trips, friends] - - name: Airlines + - name: airlines type: airline[] - allows : [read, update] searchable: true insertable: true - - name: Airports + - name: airports type: airport[] searchable: true insertable: false deletable: false - - name: Me + - name: me type: person - - name: GetNearestAirport + - name: getNearestAirport params: - name: lat type: double - name: lon type: double returns: airport - - name: ResetDataSource + - name: resetDataSource -types: +types: + - name: personGender + members: + - name: unknown + value: 0 + - name: female + value: -1 + - name: male + value: 2 + flags: false + underlyingType: int32 - name: city requiredProperties: [countryRegion, name, region] - name: location @@ -54,6 +70,9 @@ types: - address - name: city type: city + - name: eventLocation + baseType: location + optionalProperties: buildingInfo - name: airportLocation baseType: location requiredProperties: @@ -77,6 +96,8 @@ types: type: string[] - name: addressInfo type: location[] + - name: gender + type: personGender - name: concurrency type: int64 computed: true @@ -84,6 +105,7 @@ types: type: person[] - name: trips type: trip[] + containsTarget: true - name: photo type: photo operations: @@ -94,7 +116,7 @@ types: returns: trip[] - name: shareTrip params: - - userName + - sharedTo - name: tripId type: int32 - name: airline @@ -122,6 +144,26 @@ types: type: dateTimeOffset - name: duration type: duration + - name: publicTransportation + baseType: planItem + optionalProperties: seatNumber + - name: flight + baseType: publicTransportation + requiredProperties: flightNumber + optionalProperties: + - name: from + type: airport + - name: to + type: airport + - name: airline + type: airline + - name: event + baseType: planItem + dynamic: true + optionalProperties: + - description + - name: occursAt + type: eventLocation - name: trip key: tripId requiredProperties: @@ -142,4 +184,4 @@ types: contained: true operations: - name: getInvolvedPeople - returns: person[] \ No newline at end of file + returns: person[]