Skip to content

Commit

Permalink
Enumeration of schema properties should occur in a specific order to …
Browse files Browse the repository at this point in the history
…ensure a (#110)

stable output. There are unexpected changes introduced since the properties
were modeled as a dictionary vs an array and enumeration does not guarantee any
sort of ordering.
  • Loading branch information
rahul-malik authored Jan 25, 2018
1 parent df1e444 commit bcc7bef
Show file tree
Hide file tree
Showing 8 changed files with 555 additions and 551 deletions.
272 changes: 136 additions & 136 deletions Examples/Cocoa/Sources/Objective_C/Board.m

Large diffs are not rendered by default.

554 changes: 277 additions & 277 deletions Examples/Cocoa/Sources/Objective_C/Pin.m

Large diffs are not rendered by default.

232 changes: 116 additions & 116 deletions Examples/Cocoa/Sources/Objective_C/User.m

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Examples/JS/flow/BoardType.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import type { ImageType } from './ImageType.js';
import type { UserType } from './UserType.js';

export type BoardType = $Shape<{|
+name: ?string,
+id: ?string,
+image: ImageType,
+contributors: ?Set<UserType>,
+counts: ?{ +[string]: number } /* Integer */,
+created_at: ?PlankDate,
+contributors: ?Set<UserType>,
+description: ?string,
+creator: ?{ +[string]: string },
+description: ?string,
+id: ?string,
+image: ImageType,
+name: ?string,
+url: ?PlankURI,
|}> & {
id: string
Expand Down
20 changes: 10 additions & 10 deletions Examples/JS/flow/PinType.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ import type { UserType } from './UserType.js';
export type PinAttributionObjectsType = BoardType | UserType;

export type PinType = $Shape<{|
+note: ?string,
+media: ?{ +[string]: string },
+counts: ?{ +[string]: number } /* Integer */,
+description: ?string,
+creator: { +[string]: UserType },
+tags: ?Array<{}>,
+attribution: ?{ +[string]: string },
+attribution_objects: ?Array<PinAttributionObjectsType>,
+board: ?BoardType,
+visual_search_attrs: ?{},
+color: ?string,
+link: ?PlankURI,
+counts: ?{ +[string]: number } /* Integer */,
+created_at: PlankDate,
+creator: { +[string]: UserType },
+description: ?string,
+id: string,
+image: ?ImageType,
+created_at: PlankDate,
+attribution_objects: ?Array<PinAttributionObjectsType>,
+link: ?PlankURI,
+media: ?{ +[string]: string },
+note: ?string,
+tags: ?Array<{}>,
+url: ?PlankURI,
+visual_search_attrs: ?{},
|}> & {
id: string
};
Expand Down
10 changes: 5 additions & 5 deletions Examples/JS/flow/UserType.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import type { PlankDate, PlankURI } from './runtime.flow.js';
import type { ImageType } from './ImageType.js';

export type UserType = $Shape<{|
+last_name: ?string,
+id: ?string,
+first_name: ?string,
+image: ?ImageType,
+bio: ?string,
+counts: ?{ +[string]: number } /* Integer */,
+created_at: ?PlankDate,
+first_name: ?string,
+id: ?string,
+image: ?ImageType,
+last_name: ?string,
+username: ?string,
+bio: ?string,
|}> & {
id: string
};
Expand Down
4 changes: 3 additions & 1 deletion Sources/Core/JSFileRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ extension JSFileRenderer {
}

var properties: [(Parameter, SchemaObjectProperty)] {
return self.rootSchema.properties.map { $0 }
return self.rootSchema.properties.map { $0 }.sorted(by: { (obj1, obj2) -> Bool in
return obj1.0 < obj2.0
})
}

var isBaseClass: Bool {
Expand Down
4 changes: 3 additions & 1 deletion Sources/Core/ObjCFileRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ extension ObjCFileRenderer {
}

var properties: [(Parameter, SchemaObjectProperty)] {
return self.rootSchema.properties.map { $0 }
return self.rootSchema.properties.map { $0 }.sorted(by: { (obj1, obj2) -> Bool in
return obj1.0 < obj2.0
})
}

var isBaseClass: Bool {
Expand Down

0 comments on commit bcc7bef

Please sign in to comment.