Skip to content

Commit

Permalink
Merge pull request #124 from palantir/mf/sort-keys
Browse files Browse the repository at this point in the history
Sort keys in generated files for smaller (future) diffs
  • Loading branch information
mfedderly authored Mar 8, 2024
2 parents f964656 + d55e2dd commit 1f386cc
Show file tree
Hide file tree
Showing 37 changed files with 282 additions and 265 deletions.
12 changes: 6 additions & 6 deletions examples-extra/basic/sdk/src/generatedNoCheck/Ontology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import * as Objects from './ontology/objects.js';
const _Ontology = {
metadata: OntologyMetadata,
objects: {
WeatherStation: Objects.WeatherStation,
BoundariesUsState: Objects.BoundariesUsState,
Todo: Objects.Todo,
Person: Objects.Person,
Employee: Objects.Employee,
Venture: Objects.Venture,
ObjectTypeWithAllPropertyTypes: Objects.ObjectTypeWithAllPropertyTypes,
Person: Objects.Person,
Todo: Objects.Todo,
Venture: Objects.Venture,
WeatherStation: Objects.WeatherStation,
},
actions: {
actionTakesAllParameterTypes: Actions.actionTakesAllParameterTypes,
createTodo: Actions.createTodo,
assignEmployee1: Actions.assignEmployee1,
createTodo: Actions.createTodo,
},
queries: {
// TODO
Expand All @@ -27,7 +27,7 @@ const _Ontology = {
FooInterface: Interfaces.FooInterface,
},
} satisfies OntologyDefinition<
'WeatherStation' | 'BoundariesUsState' | 'Todo' | 'Person' | 'Employee' | 'Venture' | 'ObjectTypeWithAllPropertyTypes'
'BoundariesUsState' | 'Employee' | 'ObjectTypeWithAllPropertyTypes' | 'Person' | 'Todo' | 'Venture' | 'WeatherStation'
>;

type _Ontology = typeof _Ontology;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,36 @@ import type { Person, Todo } from '../objects.js';

// Represents the definition of the parameters for the action
export type ActionDef$actionTakesAllParameterTypes$Params = {
objectSet: {
multiplicity: false;
type: ObjectSetActionDataType<'Todo', Todo>;
attachmentArray: {
multiplicity: true;
nullable: false;
type: 'attachment';
};
dateArray: {
multiplicity: true;
nullable: true;
type: 'datetime';
};
object: {
description: 'A person Object';
multiplicity: false;
type: ObjectActionDataType<'Person', Person>;
nullable: true;
description: 'A person Object';
type: ObjectActionDataType<'Person', Person>;
};
string: {
objectSet: {
multiplicity: false;
type: 'string';
nullable: false;
type: ObjectSetActionDataType<'Todo', Todo>;
};
'time-stamp': {
string: {
multiplicity: false;
type: 'timestamp';
nullable: false;
type: 'string';
};
dateArray: {
multiplicity: true;
type: 'datetime';
nullable: true;
};
attachmentArray: {
multiplicity: true;
type: 'attachment';
'time-stamp': {
multiplicity: false;
nullable: false;
type: 'timestamp';
};
};

Expand All @@ -60,13 +60,13 @@ export interface ActionDef$actionTakesAllParameterTypes
'Todo' | 'ObjectTypeWithAllPropertyTypes' | 'Person',
actionTakesAllParameterTypes
> {
type: 'action';
apiName: 'actionTakesAllParameterTypes';
description: 'An action which takes different types of parameters';
modifiedEntities: {
Todo: { created: true; modified: true };
ObjectTypeWithAllPropertyTypes: { created: false; modified: true };
};
type: 'action';
parameters: ActionDef$actionTakesAllParameterTypes$Params;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import type { Employee, Venture } from '../objects.js';
export type ActionDef$assignEmployee1$Params = {
'employee-1': {
multiplicity: false;
type: ObjectActionDataType<'Employee', Employee>;
nullable: false;
type: ObjectActionDataType<'Employee', Employee>;
};
'venture-1': {
multiplicity: false;
type: ObjectActionDataType<'Venture', Venture>;
nullable: false;
type: ObjectActionDataType<'Venture', Venture>;
};
};

Expand All @@ -30,10 +30,10 @@ export interface assignEmployee1 {
// Represents the definition of the action
export interface ActionDef$assignEmployee1
extends ActionDefinition<'assignEmployee1', 'Employee' | 'Venture', assignEmployee1> {
type: 'action';
apiName: 'assignEmployee1';
description: 'Assigns an employee to a venture';
modifiedEntities: { Employee: { created: false; modified: true } };
type: 'action';
parameters: ActionDef$assignEmployee1$Params;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export interface createTodo {

// Represents the definition of the action
export interface ActionDef$createTodo extends ActionDefinition<'createTodo', 'Todo', createTodo> {
type: 'action';
apiName: 'createTodo';
description: 'Creates a new Todo';
modifiedEntities: { Todo: { created: true; modified: false } };
type: 'action';
parameters: ActionDef$createTodo$Params;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import type { InterfaceDefinition, PropertyDef } from '@osdk/api';

export interface FooInterface extends InterfaceDefinition<'FooInterface', FooInterface> {
description: 'Its a Foo.';
links: {};
properties: {
name: PropertyDef<'string', 'nullable', 'single'>;
description: PropertyDef<'string', 'nullable', 'single'>;
name: PropertyDef<'string', 'nullable', 'single'>;
};
links: {};
}

export const FooInterface: FooInterface = {
type: 'interface',
apiName: 'FooInterface',
description: 'Its a Foo.',
links: {},
properties: {
name: {
multiplicity: false,
Expand All @@ -27,5 +27,5 @@ export const FooInterface: FooInterface = {
nullable: true,
},
},
links: {},
type: 'interface',
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@ import type { ObjectTypeDefinition, PropertyDef } from '@osdk/api';

export interface BoundariesUsState extends ObjectTypeDefinition<'BoundariesUsState', BoundariesUsState> {
description: 'Boundaries US State';
links: {};
primaryKeyApiName: 'usState';
primaryKeyType: 'string';
links: {};
properties: {
usState: PropertyDef<'string', 'non-nullable', 'single'>;
geometry10M: PropertyDef<'geoshape', 'nullable', 'single'>;
latitude: PropertyDef<'double', 'nullable', 'single'>;
longitude: PropertyDef<'double', 'nullable', 'single'>;
geometry10M: PropertyDef<'geoshape', 'nullable', 'single'>;
usState: PropertyDef<'string', 'non-nullable', 'single'>;
};
}

export const BoundariesUsState: BoundariesUsState = {
type: 'object',
apiName: 'BoundariesUsState',
description: 'Boundaries US State',
links: {},
primaryKeyApiName: 'usState',
primaryKeyType: 'string',
links: {},
properties: {
usState: {
multiplicity: false,
Expand All @@ -43,4 +42,5 @@ export const BoundariesUsState: BoundariesUsState = {
nullable: true,
},
},
type: 'object',
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,46 @@ import type { Venture } from './Venture.js';

export interface Employee extends ObjectTypeDefinition<'Employee', Employee> {
description: 'An employee';
primaryKeyApiName: 'id';
primaryKeyType: 'string';
implements: ['FooInterface'];
inverseSpts: {
name: 'firstName';
description: 'email';
};
links: {
lead: ObjectTypeLinkDefinition<Employee, false>;
peeps: ObjectTypeLinkDefinition<Employee, true>;
ventures: ObjectTypeLinkDefinition<Venture, true>;
};
primaryKeyApiName: 'id';
primaryKeyType: 'string';
properties: {
id: PropertyDef<'string', 'non-nullable', 'single'>;
firstName: PropertyDef<'string', 'nullable', 'single'>;
email: PropertyDef<'string', 'nullable', 'single'>;
adUsername: PropertyDef<'string', 'nullable', 'single'>;
locationName: PropertyDef<'string', 'nullable', 'single'>;
locationCity: PropertyDef<'string', 'nullable', 'single'>;
firstFullTimeStartDate: PropertyDef<'datetime', 'nullable', 'single'>;
businessTitle: PropertyDef<'string', 'nullable', 'single'>;
email: PropertyDef<'string', 'nullable', 'single'>;
employeeNumber: PropertyDef<'double', 'nullable', 'single'>;
favPlace: PropertyDef<'geopoint', 'nullable', 'single'>;
firstFullTimeStartDate: PropertyDef<'datetime', 'nullable', 'single'>;
firstName: PropertyDef<'string', 'nullable', 'single'>;
id: PropertyDef<'string', 'non-nullable', 'single'>;
jobProfile: PropertyDef<'string', 'nullable', 'single'>;
locationCity: PropertyDef<'string', 'nullable', 'single'>;
locationName: PropertyDef<'string', 'nullable', 'single'>;
locationType: PropertyDef<'string', 'nullable', 'single'>;
favPlace: PropertyDef<'geopoint', 'nullable', 'single'>;
};
spts: {
firstName: 'name';
email: 'description';
};
inverseSpts: {
name: 'firstName';
description: 'email';
};
implements: ['FooInterface'];
}

export const Employee: Employee = {
type: 'object',
apiName: 'Employee',
description: 'An employee',
primaryKeyApiName: 'id',
primaryKeyType: 'string',
implements: ['FooInterface'],
inverseSpts: {
name: 'firstName',
description: 'email',
},
links: {
lead: {
multiplicity: false,
Expand All @@ -56,6 +58,8 @@ export const Employee: Employee = {
targetType: 'Venture',
},
},
primaryKeyApiName: 'id',
primaryKeyType: 'string',
properties: {
id: {
multiplicity: false,
Expand Down Expand Up @@ -122,9 +126,5 @@ export const Employee: Employee = {
firstName: 'name',
email: 'description',
},
inverseSpts: {
name: 'firstName',
description: 'email',
},
implements: ['FooInterface'],
type: 'object',
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,50 @@ import type { ObjectTypeDefinition, PropertyDef } from '@osdk/api';
export interface ObjectTypeWithAllPropertyTypes
extends ObjectTypeDefinition<'ObjectTypeWithAllPropertyTypes', ObjectTypeWithAllPropertyTypes> {
description: 'A type with all property types';
links: {};
primaryKeyApiName: 'id';
primaryKeyType: 'integer';
links: {};
properties: {
id: PropertyDef<'integer', 'non-nullable', 'single'>;
string: PropertyDef<'string', 'nullable', 'single'>;
attachment: PropertyDef<'attachment', 'nullable', 'single'>;
attachmentArray: PropertyDef<'attachment', 'nullable', 'array'>;
boolean: PropertyDef<'boolean', 'nullable', 'single'>;
booleanArray: PropertyDef<'boolean', 'nullable', 'array'>;
byte: PropertyDef<'byte', 'nullable', 'single'>;
byteArray: PropertyDef<'byte', 'nullable', 'array'>;
date: PropertyDef<'datetime', 'nullable', 'single'>;
dateArray: PropertyDef<'datetime', 'nullable', 'array'>;
dateTime: PropertyDef<'timestamp', 'nullable', 'single'>;
dateTimeArray: PropertyDef<'timestamp', 'nullable', 'array'>;
decimal: PropertyDef<'decimal', 'nullable', 'single'>;
integer: PropertyDef<'integer', 'nullable', 'single'>;
long: PropertyDef<'long', 'nullable', 'single'>;
short: PropertyDef<'short', 'nullable', 'single'>;
float: PropertyDef<'float', 'nullable', 'single'>;
decimalArray: PropertyDef<'decimal', 'nullable', 'array'>;
double: PropertyDef<'double', 'nullable', 'single'>;
byte: PropertyDef<'byte', 'nullable', 'single'>;
attachment: PropertyDef<'attachment', 'nullable', 'single'>;
doubleArray: PropertyDef<'double', 'nullable', 'array'>;
float: PropertyDef<'float', 'nullable', 'single'>;
floatArray: PropertyDef<'float', 'nullable', 'array'>;
geoPoint: PropertyDef<'geopoint', 'nullable', 'single'>;
geoPointArray: PropertyDef<'geopoint', 'nullable', 'array'>;
geoShape: PropertyDef<'geoshape', 'nullable', 'single'>;
stringArray: PropertyDef<'string', 'nullable', 'array'>;
booleanArray: PropertyDef<'boolean', 'nullable', 'array'>;
dateArray: PropertyDef<'datetime', 'nullable', 'array'>;
dateTimeArray: PropertyDef<'timestamp', 'nullable', 'array'>;
decimalArray: PropertyDef<'decimal', 'nullable', 'array'>;
geoShapeArray: PropertyDef<'geoshape', 'nullable', 'array'>;
id: PropertyDef<'integer', 'non-nullable', 'single'>;
integer: PropertyDef<'integer', 'nullable', 'single'>;
integerArray: PropertyDef<'integer', 'nullable', 'array'>;
long: PropertyDef<'long', 'nullable', 'single'>;
longArray: PropertyDef<'long', 'nullable', 'array'>;
shortArray: PropertyDef<'short', 'nullable', 'array'>;
floatArray: PropertyDef<'float', 'nullable', 'array'>;
doubleArray: PropertyDef<'double', 'nullable', 'array'>;
byteArray: PropertyDef<'byte', 'nullable', 'array'>;
attachmentArray: PropertyDef<'attachment', 'nullable', 'array'>;
geoPointArray: PropertyDef<'geopoint', 'nullable', 'array'>;
geoShapeArray: PropertyDef<'geoshape', 'nullable', 'array'>;
numericTimeseries: PropertyDef<'numericTimeseries', 'nullable', 'single'>;
short: PropertyDef<'short', 'nullable', 'single'>;
shortArray: PropertyDef<'short', 'nullable', 'array'>;
string: PropertyDef<'string', 'nullable', 'single'>;
stringArray: PropertyDef<'string', 'nullable', 'array'>;
stringTimeseries: PropertyDef<'stringTimeseries', 'nullable', 'single'>;
};
}

export const ObjectTypeWithAllPropertyTypes: ObjectTypeWithAllPropertyTypes = {
type: 'object',
apiName: 'ObjectTypeWithAllPropertyTypes',
description: 'A type with all property types',
links: {},
primaryKeyApiName: 'id',
primaryKeyType: 'integer',
links: {},
properties: {
id: {
multiplicity: false,
Expand Down Expand Up @@ -205,4 +204,5 @@ export const ObjectTypeWithAllPropertyTypes: ObjectTypeWithAllPropertyTypes = {
nullable: true,
},
},
type: 'object',
};
Loading

0 comments on commit 1f386cc

Please sign in to comment.